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 string JSON value with a given content.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">value</td><td>a value for the string</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 string 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 an <aclass="el"href="classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html#ace8338e57fdb11e1955c2a0c2d782069">string_t</a> parameter. <divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="preprocessor">#include <json.hpp></span></div>
<divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment">// create an string_t value</span></div>
<divclass="line"><aname="l00008"></a><spanclass="lineno"> 8</span> <aclass="code"href="classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html#ace8338e57fdb11e1955c2a0c2d782069">json::string_t</a> value = <spanclass="stringliteral">"The quick brown fox jumps over the lazy doc"</span>;</div>
<divclass="ttc"id="classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069_html_ace8338e57fdb11e1955c2a0c2d782069"><divclass="ttname"><ahref="classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html#ace8338e57fdb11e1955c2a0c2d782069">nlohmann::basic_json::string_t</a></div><divclass="ttdeci">StringType string_t</div><divclass="ttdoc">a type for a string </div><divclass="ttdef"><b>Definition:</b> json.hpp:191</div></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">"The quick brown fox jumps over the lazy doc"
</pre> The example code above can be translated with<preclass="fragment">g++ -std=c++11 -Isrc doc/examples/basic_json__string_t.cpp -o basic_json__string_t </pre>.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classnlohmann_1_1basic__json_a2448b2777e8a3e48614e1b3c41b96f7c.html#a2448b2777e8a3e48614e1b3c41b96f7c"title="create a string (explicit) ">basic_json(const typename string_t::value_type*)</a></dd>
<dd>
<aclass="el"href="classnlohmann_1_1basic__json_ae42d32c34c8014b1bf677fdb7baa5401.html#ae42d32c34c8014b1bf677fdb7baa5401"title="create a string (implicit) ">basic_json(const CompatibleStringType&)</a></dd></dl>