[#BloombergLP-baljsn-Encoder-encodeAny-07]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/Encoder.adoc[Encoder]::encodeAny
:relfileprefix: ../../../
:mrdocs:

`encodeAny` overloads

== Synopses

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

Encode the specified `any` without instantiating templates at compile time&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
xref:BloombergLP/baljsn/Encoder/encodeAny-0c1.adoc[encodeAny](
    std::ostream& stream,
    xref:BloombergLP/bdlar/AnyConstRef.adoc[bdlar::AnyConstRef] const& any,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const& options);
----

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-0c1.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, accepting a nullable `options` pointer&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
xref:BloombergLP/baljsn/Encoder/encodeAny-04.adoc[encodeAny](
    std::ostream& stream,
    xref:BloombergLP/bdlar/AnyConstRef.adoc[bdlar::AnyConstRef] const& any,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const* options = 0);
----

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-04.adoc[_» more&period;&period;&period;_]#

Encode the specified `any` without instantiating templates at compile time&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
xref:BloombergLP/baljsn/Encoder/encodeAny-0df.adoc[encodeAny](
    std::streambuf* streamBuf,
    xref:BloombergLP/bdlar/AnyConstRef.adoc[bdlar::AnyConstRef] const& any,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const& options);
----

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-0df.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, accepting a nullable `options` pointer&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
xref:BloombergLP/baljsn/Encoder/encodeAny-0d0.adoc[encodeAny](
    std::streambuf* streamBuf,
    xref:BloombergLP/bdlar/AnyConstRef.adoc[bdlar::AnyConstRef] const& any,
    xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const* options = 0);
----

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-0d0.adoc[_» more&period;&period;&period;_]#

Encode `value` as JSON onto `stream` using `options` without instantiating templates at compile time&period;


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

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-0cf.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, accepting a nullable `options` pointer&period;


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

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-08.adoc[_» more&period;&period;&period;_]#

Encode `value` as JSON onto `streamBuf` using `options` without instantiating templates at compile time&period;


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

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-01.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, accepting a nullable `options` pointer&period;


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

[.small]#xref:BloombergLP/baljsn/Encoder/encodeAny-06.adoc[_» more&period;&period;&period;_]#

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *stream*
| output stream for JSON
| *any*
| type&hyphen;erased value to encode
| *options*
| encoding options
| *streamBuf*
| output buffer for JSON
| *value*
| value to encode
|===


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