[#BloombergLP-baljsn-DatumUtil-encode-08]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/DatumUtil.adoc[DatumUtil]::encode
:relfileprefix: ../../../
:mrdocs:

Encode `datum` as JSON into `result` as a `std&colon;&colon;pmr&colon;&colon;string`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
encode(
    std::pmr::string* result,
    xref:BloombergLP/bdld/Datum.adoc[bdld::Datum] const& datum);
----

== Description

Same as the preceding overload, loading into a `std&colon;&colon;pmr&colon;&colon;string`&period;

== Return Value

0 on success, a negative value on failure, or a positive value if `strictTypes` is enabled and an unsupported type is encoded

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| receives the encoded JSON string
| *datum*
| `Datum` to encode
|===


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