[#BloombergLP-baljsn-Encoder-encode-0a] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/Encoder.adoc[Encoder]::encode :relfileprefix: ../../../ :mrdocs: `encode` overloads == Synopses Declared in `<baljsn_encoder.h>` Encode the specified `value` of (template parameter) `TYPE` into the specified `stream`. Return 0 on success, and a non‐zero value otherwise. Note that `stream` will be invalidated if the encoding failed. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-0e7.adoc[encode]( std::ostream& stream, TYPE const& value); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-0e7.adoc[_» more..._]# Encode the specified `value` of (template parameter) `TYPE` into the specified `streamBuf`. Return 0 on success, and a non‐zero value otherwise. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-0ea.adoc[encode]( std::streambuf* streamBuf, TYPE const& value); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-0ea.adoc[_» more..._]# Encode the specified `value`, of (template parameter) `TYPE`, in the JSON format using the specified `options` and output it onto the specified `stream`. Specifying a nullptr `options` is equivalent to passing a default‐constructed EncoderOptions in `options`. `TYPE` shall be a `bdlat`‐compatible choice, or array type, or a `bdlat`‐compatible dynamic type referring to one of those types. Return 0 on success, and a non‐zero value otherwise. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-09.adoc[encode]( std::ostream& stream, TYPE const& value, xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const& options); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-09.adoc[_» more..._]# Same as the preceding overload, accepting a nullable `options` pointer. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-05.adoc[encode]( std::ostream& stream, TYPE const& value, xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const* options); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-05.adoc[_» more..._]# Encode the specified `value`, of (template parameter) `TYPE`, in the JSON format using the specified `options` and output it onto the specified `streamBuf`. Specifying a nullptr `options` is equivalent to passing a default‐constructed EncoderOptions in `options`. `TYPE` shall be a `bdlat`‐compatible sequence, choice, or array type, or a `bdlat`‐compatible dynamic type referring to one of those types. Return 0 on success, and a non‐zero value otherwise. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-06.adoc[encode]( std::streambuf* streamBuf, TYPE const& value, xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const& options); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-06.adoc[_» more..._]# Same as the preceding overload, accepting a nullable `options` pointer. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int xref:BloombergLP/baljsn/Encoder/encode-00.adoc[encode]( std::streambuf* streamBuf, TYPE const& value, xref:BloombergLP/baljsn/EncoderOptions.adoc[EncoderOptions] const* options); ---- [.small]#xref:BloombergLP/baljsn/Encoder/encode-00.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#