template<template< typename U, typename V, typename...Args > class ObjectType = std::map, template< typename U, typename...Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = int64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator></div>
<p>Create an object JSON value with a given content. This constructor allows any type that can be used to construct values of type <aclass="el"href="classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html#a63691315292df8e1522b00d37ebb1ffc">object_t</a>. Examples include the types <code>std::map</code> and <code>std::unordered_map</code>.</p>
<tr><tdclass="paramname">CompatibleObjectType</td><td>an object type whose <code>key_type</code> and <code>value_type</code> is compatible to <aclass="el"href="classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html#a63691315292df8e1522b00d37ebb1ffc">object_t</a></td></tr>
</table>
</dd>
</dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">value</td><td>a value for the object</td></tr>
</table>
</dd>
</dl>
<dlclass="section user"><dt>Complexity</dt><dd>Linear in the size of the passed <em>value</em>.</dd></dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname">std::bad_alloc</td><td>if allocation for object value fails (thrown by the constructor of <aclass="el"href="unionnlohmann_1_1basic__json_1_1json__value.html">json_value</a>)</td></tr>
</table>
</dd>
</dl>
<dlclass="section user"><dt>Example</dt><dd>The following code shows the constructor with several compatible object type parameters. <divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="preprocessor">#include <json.hpp></span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <aclass="code"href="classnlohmann_1_1basic__json.html">json</a> j_mmap(c_mmap); <spanclass="comment">// only one entry for key "three" is used</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment">// create an object from std::unordered_multimap</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <aclass="code"href="classnlohmann_1_1basic__json.html">json</a> j_ummap(c_ummap); <spanclass="comment">// only one entry for key "three" is used</span></div>
<divclass="ttc"id="classnlohmann_1_1basic__json_html"><divclass="ttname"><ahref="classnlohmann_1_1basic__json.html">nlohmann::basic_json</a></div><divclass="ttdoc">a class to store JSON values </div><divclass="ttdef"><b>Definition:</b> json.hpp:113</div></div>
<divclass="ttc"id="namespacenlohmann_html"><divclass="ttname"><ahref="namespacenlohmann.html">nlohmann</a></div><divclass="ttdoc">namespace for Niels Lohmann </div><divclass="ttdef"><b>Definition:</b> json.hpp:49</div></div>
</div><!-- fragment --> Output: <preclass="fragment">{"one":1,"three":3,"two":2}
{"one":1.2,"three":3.4,"two":2.3}
{"one":true,"three":false,"two":true}
{"one":true,"three":false,"two":true}
</pre> The example code above can be translated with<preclass="fragment">g++ -std=c++11 -Isrc doc/examples/basic_json__CompatibleObjectType.cpp -o basic_json__CompatibleObjectType </pre>.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classnlohmann_1_1basic__json_a0a9c6a1fccc4db365860463e8203eb38.html#a0a9c6a1fccc4db365860463e8203eb38"title="create an object (explicit) ">basic_json(const object_t&)</a></dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->