[#BloombergLP-baljsn-JsonFormatter-putValue]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/JsonFormatter.adoc[JsonFormatter]::putValue
:relfileprefix: ../../../
:mrdocs:

Set the current scalar, array element, or object member to `value`&period;

== Synopsis

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

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

== Description

Set the value of the current scalar, array element, or object value &hyphen;&hyphen; depending on the context &hyphen;&hyphen; to the specified `value` of (template parameter) `TYPE`&period; The specified `options` is ignored except&colon; &ast; `encodeInfAndNaNAsStrings` when `TYPE` is a floating point type&period; &ast; `datetimeFractionalSecondPrecision` when `TYPE` features a datetime or time attribute&period; Return 0 on success and a non&hyphen;zero value otherwise&period; Errors are returned if `value` is disallowed for `bdljsn&colon;&colon;Json` objects&colon; &ast; `value` is a string type and contains a non&hyphen;UTF8 character&period; &ast; `value` is a floating point type, is INF or NaN, and `false &equals;&equals; encodeInfAndNanAsStrings`&period;

== Return Value

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

== Parameters

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


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