From cff4d40afdab482c1f9f3fa21d3bc6464c2563f0 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 29 Dec 2014 17:07:00 +0100 Subject: [PATCH] type reference --- Reference.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Reference.md b/Reference.md index 7309d5c1f..4846302d9 100644 --- a/Reference.md +++ b/Reference.md @@ -19,3 +19,17 @@ There are only a few type conversions possible: - A floating pointnnumber can be translated to an integer number (e.g., by calling `get()`). Note the number is truncated and not rounded, ceiled or floored. - Any value but JSON objects can be translated into an array. The result is a singleton array that consists of the value before. - Any other conversion will throw a `std::logic_error` exception. + +## Initialization + +JSON values can be created from many literals and variable types: + +| JSON type | literal/variable types | +| --------- | ---------------------- | +| none | `nullptr` literal, `nullptr_t` type, no value | +| string | string literal, `char*` type, `std::string` type, `std::string&&` rvalue reference, `JSON::string_t` type | +| number (integer) | integer literal, `int` type, `JSON_number_t` type | +| number (floating point) | floating point literal, `double` type, `JSON::number_float_t` type | +| array | initializer list whose elements are `JSON` values (or can be translated into `JSON` values using the rules above), `std::vector` type, `JSON::array_t` type | +| object | initializer list whose elements are pairs of a string literal and a `JSON` value (or can be translated into `JSON` values using the rules above), `std::map` type, `JSON::object_t` type | + -- GitLab