[#nlohmann-basic_json-0c-to_ubjson-0b3]
= xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic&lowbar;json]::to&lowbar;ubjson
:relfileprefix: ../../
:mrdocs:

create a UBJSON serialization of a given JSON value

== Synopsis

Declared in `&lt;nlohmann&sol;json&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
to&lowbar;ubjson(
    xref:nlohmann/basic_json-0c.adoc[basic&lowbar;json] const& j,
    &sol;&ast; implementation-defined &ast;&sol;::output&lowbar;adapter&lt;uint8&lowbar;t&gt; o,
    bool const use&lowbar;size = false,
    bool const use&lowbar;type = false);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *j*
| JSON value to serialize
| *o*
| output adapter to write the serialization to
| *use&lowbar;size*
| whether to add size annotations to container types
| *use&lowbar;type*
| whether to add type annotations to container types (must be combined with _use&lowbar;size_ &equals; true)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
