[#BloombergLP-baljsn-EncodeImplUtil-encode-0a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/EncodeImplUtil.adoc[EncodeImplUtil]::encode
:relfileprefix: ../../../
:mrdocs:

`encode` overloads

== Synopses

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

Encode the JSON representation of `value` to `jsonStream`&period;


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

[.small]#xref:BloombergLP/baljsn/EncodeImplUtil/encode-0e.adoc[_» more&period;&period;&period;_]#

Encode the JSON representation of `value` to `jsonStream`, logging errors to `logStream`&period;


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

[.small]#xref:BloombergLP/baljsn/EncodeImplUtil/encode-0b1.adoc[_» more&period;&period;&period;_]#

Encode the JSON representation of `value` to `formatter`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
static
int
xref:BloombergLP/baljsn/EncodeImplUtil/encode-0be.adoc[encode](
    bool* isValueEmpty,
    FORMATTER* formatter,
    std::ostream* logStream,
    TYPE const& value,
    xref:BloombergLP/baljsn/EncodeImplUtil/FormattingMode.adoc[FormattingMode] formattingMode,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const& options,
    bool isFirstMember);
----

[.small]#xref:BloombergLP/baljsn/EncodeImplUtil/encode-0be.adoc[_» more&period;&period;&period;_]#

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *jsonStream*
| stream that receives the JSON representation
| *value*
| value to encode
| *options*
| encoding options
| *logStream*
| stream for human&hyphen;readable error descriptions
| *isValueEmpty*
| receives whether the representation is empty
| *formatter*
| JSON formatter that receives the encoded tokens
| *formattingMode*
| formatting&hyphen;mode bit&hyphen;field for the value
| *isFirstMember*
| if `true`, omit a leading sequence delimiter
|===


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