TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ unflatten()

template<typename BasicJsonType >
static BasicJsonType nlohmann::json_pointer< BasicJsonType >::unflatten ( const BasicJsonType &  value)
inlinestaticprivate
Parameters
[in]valueflattened JSON
Returns
unflattened JSON
Exceptions
parse_error.109if array index is not a number
type_error.314if value is not an object
type_error.315if object values are not primitive
type_error.313if value cannot be unflattened

Definition at line 13480 of file json.hpp.

13481 {
13482 if (JSON_HEDLEY_UNLIKELY(!value.is_object()))
13483 {
13484 JSON_THROW(detail::type_error::create(314, "only objects can be unflattened", value));
13485 }
13486
13487 BasicJsonType result;
13488
13489 // iterate the JSON object values
13490 for (const auto &element : *value.m_value.object)
13491 {
13492 if (JSON_HEDLEY_UNLIKELY(!element.second.is_primitive()))
13493 {
13494 JSON_THROW(detail::type_error::create(315, "values in object must be primitive", element.second));
13495 }
13496
13497 // assign value to reference pointed to by JSON pointer; Note that if
13498 // the JSON pointer is "" (i.e., points to the whole value), function
13499 // get_and_create returns a reference to result itself. An assignment
13500 // will then create a primitive value.
13501 json_pointer(element.first).get_and_create(result) = element.second;
13502 }
13503
13504 return result;
13505 }
json_pointer(const std::string &s="")
create JSON pointer
Definition: json.hpp:12591
@ value
the parser finished reading a JSON value