[#BloombergLP-baljsn-DatumUtil-decode-0e]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/DatumUtil.adoc[DatumUtil]::decode
:relfileprefix: ../../../
:mrdocs:

Decode the specified `json` into the specified `result`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
decode(
    xref:BloombergLP/bdld/ManagedDatum.adoc[bdld::ManagedDatum]* result,
    std::string&lowbar;view const& json);
----

== Description

If the optionally specified `errorStream` is non&hyphen;null, a description of any errors that occur during parsing will be output to this stream&period; If the optionally specified `options` argument is not present, treat it as a default&hyphen;constructed `DatumDecoderOptions`&period; Return 0 on success, and a negative value if `json` could not be decoded (either because it is ill&hyphen;formed, or if a constraint imposed by `option` is violated)&period; An error status will be returned if `json` contains arrays or objects that are nested beyond a depth configured by `options&period;maxNestedDepth()`&period; The mapping of types in JSON to the types supported by `Datum` is described in &lsqb;&rsqb;Types)&period;

== Return Value

0 on success, and a negative value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| receives the decoded `Datum`
| *json*
| JSON text to decode
|===


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