[#BloombergLP-baljsn-JsonFormatter_Util-valueAsJson-00]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/JsonFormatter_Util.adoc[JsonFormatter&lowbar;Util]::valueAsJson
:relfileprefix: ../../../
:mrdocs:

Load the JSON representation of `value` into the specified `json`&period;

== Synopsis

Declared in `&lt;baljsn&lowbar;jsonformatter&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
static
int
valueAsJson(
    xref:BloombergLP/bdljsn/Json.adoc[bdljsn::Json]* json,
    TYPE const& value,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const* options);
----

== Description

Optionally use the specified `options`&period; Return 0 on success and a non&hyphen;zero value otherwise&period;

== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-025.adoc[`valueAsJson&lt;Date&gt;`] 
| Load the JSON representation of the `Date` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-045.adoc[`valueAsJson&lt;DateTz&gt;`] 
| Load the JSON representation of the `DateTz` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-0bc8.adoc[`valueAsJson&lt;Datetime&gt;`] 
| Load the JSON representation of the `Datetime` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-0d.adoc[`valueAsJson&lt;DatetimeTz&gt;`] 
| Load the JSON representation of the `DatetimeTz` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-0a.adoc[`valueAsJson&lt;Decimal&lowbar;Type64&gt;`] 
| Load the JSON representation of the `Decimal64` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-066.adoc[`valueAsJson&lt;Time&gt;`] 
| Load the JSON representation of the `Time` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-02f.adoc[`valueAsJson&lt;TimeTz&gt;`] 
| Load the JSON representation of the `TimeTz` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-068.adoc[`valueAsJson&lt;double&gt;`] 
| Load the JSON representation of the `double` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-05.adoc[`valueAsJson&lt;float&gt;`] 
| Load the JSON representation of the `float` `value` into `json`&period;
| xref:BloombergLP/baljsn/JsonFormatter_Util/valueAsJson-0bcb.adoc[`valueAsJson&lt;basic&lowbar;string&lt;char&gt;&gt;`] 
| Load the JSON representation of the `bsl&colon;&colon;string` `value` into `json`&period;
|===


== Return Value

0 on success and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *json*
| JSON object to receive the encoded value
| *value*
| value to encode as JSON
| *options*
| optional encoding options&semi; null uses defaults
|===


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