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>Deserializes an input stream to a JSON value.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in,out]</td><tdclass="paramname">i</td><td>input stream to read a serialized JSON value from </td></tr>
<tr><tdclass="paramdir">[in,out]</td><tdclass="paramname">j</td><td>JSON value to write the deserialized input to</td></tr>
</table>
</dd>
</dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname">std::invalid_argument</td><td>in case of parse errors</td></tr>
</table>
</dd>
</dl>
<dlclass="section user"><dt>Complexity</dt><dd>Linear in the length of the input. The parser is a predictive LL(1) parser.</dd></dl>
<dlclass="section user"><dt>Example</dt><dd>The example below shows how a JSON value is constructed by reading a serialization from a stream. <divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="preprocessor">#include <json.hpp></span></div>
<divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="stringliteral"></span><spanclass="comment">// create JSON value and read the serialization from the stream</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:121</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:56</div></div>
</div><!-- fragment --> Output: <preclass="fragment">{
"array": [
1,
2,
3,
4,
5
],
"boolean": false,
"null": null,
"number": 23,
"string": "Hello, world!"
}
</pre> The example code above can be translated with<preclass="fragment">g++ -std=c++11 -Isrc doc/examples/operator_deserialize.cpp -o operator_deserialize </pre>.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html#a74ccfa471a0c061876b247f820f3c741"title="deserialize from stream ">parse(std::istream&, parser_callback_t)</a> for a variant with a parser callback function to filter values while parsing </dd></dl>