mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
deploy: 0f9e6ae098
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
<span class=k>static</span><span class=w> </span><span class=kt>void</span><span class=w> </span><span class=nf>to_bjdata</span><span class=p>(</span><span class=k>const</span><span class=w> </span><span class=n>basic_json</span><span class=o>&</span><span class=w> </span><span class=n>j</span><span class=p>,</span><span class=w> </span><span class=n>detail</span><span class=o>::</span><span class=n>output_adapter</span><span class=o><</span><span class=kt>char</span><span class=o>></span><span class=w> </span><span class=n>o</span><span class=p>,</span>
|
||||
<span class=w> </span><span class=k>const</span><span class=w> </span><span class=kt>bool</span><span class=w> </span><span class=n>use_size</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=nb>false</span><span class=p>,</span><span class=w> </span><span class=k>const</span><span class=w> </span><span class=kt>bool</span><span class=w> </span><span class=n>use_type</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=nb>false</span><span class=p>,</span>
|
||||
<span class=w> </span><span class=k>const</span><span class=w> </span><span class=n>bjdata_version_t</span><span class=w> </span><span class=n>version</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=n>bjdata_version_t</span><span class=o>::</span><span class=n>draft2</span><span class=p>);</span>
|
||||
</code></pre></div> <p>Serializes a given <abbr title="JavaScript Object Notation">JSON</abbr> value <code>j</code> to a byte vector using the <abbr title="Binary JData">BJData</abbr> (Binary JData) serialization format. <abbr title="Binary JData">BJData</abbr> aims to be more compact than <abbr title="JavaScript Object Notation">JSON</abbr> itself, yet more efficient to parse.</p> <ol> <li>Returns a byte vector containing the <abbr title="Binary JData">BJData</abbr> serialization.</li> <li>Writes the <abbr title="Binary JData">BJData</abbr> serialization to an output adapter.</li> </ol> <p>The exact mapping and its limitations is described on a <a href=../../../features/binary_formats/bjdata/ >dedicated page</a>.</p> <h2 id=parameters>Parameters<a class=headerlink href=#parameters title="Permanent link">¶</a></h2> <dl> <dt><code>j</code> (in)</dt> <dd><abbr title="JavaScript Object Notation">JSON</abbr> value to serialize</dd> <dt><code>o</code> (in)</dt> <dd>output adapter to write serialization to</dd> <dt><code>use_size</code> (in)</dt> <dd>whether to add size annotations to container types; optional, <code class=highlight><span class=nb>false</span></code> by default.</dd> <dt><code>use_type</code> (in)</dt> <dd>whether to add type annotations to container types (must be combined with <code class=highlight><span class=n>use_size</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=nb>true</span></code>); optional, <code class=highlight><span class=nb>false</span></code> by default.</dd> <dt><code>version</code> (in)</dt> <dd>which version of <abbr title="Binary JData">BJData</abbr> to use (see <a href=../../../features/binary_formats/bjdata/#draft-3-binary-format>draft 3</a>); optional, <code class=highlight><span class=n>bjdata_version_t</span><span class=o>::</span><span class=n>draft2</span></code> by default.</dd> </dl> <h2 id=return-value>Return value<a class=headerlink href=#return-value title="Permanent link">¶</a></h2> <ol> <li><abbr title="Binary JData">BJData</abbr> serialization as byte vector</li> <li>(none)</li> </ol> <h2 id=exception-safety>Exception safety<a class=headerlink href=#exception-safety title="Permanent link">¶</a></h2> <p>Strong guarantee: if an exception is thrown, there are no changes in the <abbr title="JavaScript Object Notation">JSON</abbr> value.</p> <h2 id=complexity>Complexity<a class=headerlink href=#complexity title="Permanent link">¶</a></h2> <p>Linear in the size of the <abbr title="JavaScript Object Notation">JSON</abbr> value <code>j</code>.</p> <h2 id=examples>Examples<a class=headerlink href=#examples title="Permanent link">¶</a></h2> <details class=example> <summary>Example</summary> <p>The example shows the serialization of a <abbr title="JavaScript Object Notation">JSON</abbr> value to a byte vector in <abbr title="Binary JData">BJData</abbr> format.</p> <div class=highlight><pre><span></span><code><span class=cp>#include</span><span class=w> </span><span class=cpf><iostream></span>
|
||||
</code></pre></div> <p>Serializes a given <abbr title="JavaScript Object Notation">JSON</abbr> value <code>j</code> to a byte vector using the <abbr title="Binary JData">BJData</abbr> (Binary JData) serialization format. <abbr title="Binary JData">BJData</abbr> aims to be more compact than <abbr title="JavaScript Object Notation">JSON</abbr> itself, yet more efficient to parse.</p> <ol> <li>Returns a byte vector containing the <abbr title="Binary JData">BJData</abbr> serialization.</li> <li>Writes the <abbr title="Binary JData">BJData</abbr> serialization to an output adapter.</li> </ol> <p>The exact mapping and its limitations is described on a <a href=../../../features/binary_formats/bjdata/ >dedicated page</a>.</p> <h2 id=parameters>Parameters<a class=headerlink href=#parameters title="Permanent link">¶</a></h2> <dl> <dt><code>j</code> (in)</dt> <dd><abbr title="JavaScript Object Notation">JSON</abbr> value to serialize</dd> <dt><code>o</code> (in)</dt> <dd>output adapter to write serialization to</dd> <dt><code>use_size</code> (in)</dt> <dd>whether to add size annotations to container types; optional, <code class=highlight><span class=nb>false</span></code> by default.</dd> <dt><code>use_type</code> (in)</dt> <dd>whether to add type annotations to container types (must be combined with <code class=highlight><span class=n>use_size</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=nb>true</span></code>); optional, <code class=highlight><span class=nb>false</span></code> by default.</dd> <dt><code>version</code> (in)</dt> <dd>which version of <abbr title="Binary JData">BJData</abbr> to use (see note on "Binary values" on <a href=../../../features/binary_formats/bjdata/ ><abbr title="Binary JData">BJData</abbr></a>); optional, <code class=highlight><span class=n>bjdata_version_t</span><span class=o>::</span><span class=n>draft2</span></code> by default.</dd> </dl> <h2 id=return-value>Return value<a class=headerlink href=#return-value title="Permanent link">¶</a></h2> <ol> <li><abbr title="Binary JData">BJData</abbr> serialization as byte vector</li> <li>(none)</li> </ol> <h2 id=exception-safety>Exception safety<a class=headerlink href=#exception-safety title="Permanent link">¶</a></h2> <p>Strong guarantee: if an exception is thrown, there are no changes in the <abbr title="JavaScript Object Notation">JSON</abbr> value.</p> <h2 id=complexity>Complexity<a class=headerlink href=#complexity title="Permanent link">¶</a></h2> <p>Linear in the size of the <abbr title="JavaScript Object Notation">JSON</abbr> value <code>j</code>.</p> <h2 id=examples>Examples<a class=headerlink href=#examples title="Permanent link">¶</a></h2> <details class=example> <summary>Example</summary> <p>The example shows the serialization of a <abbr title="JavaScript Object Notation">JSON</abbr> value to a byte vector in <abbr title="Binary JData">BJData</abbr> format.</p> <div class=highlight><pre><span></span><code><span class=cp>#include</span><span class=w> </span><span class=cpf><iostream></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><iomanip></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><nlohmann/json.hpp></span>
|
||||
|
||||
|
Reference in New Issue
Block a user