[#BloombergLP-baljsn-Encoder-encode-0e7] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::xref:BloombergLP/baljsn/Encoder.adoc[Encoder]::encode :relfileprefix: ../../../ :mrdocs: Encode `value` as JSON onto `stream` using default options. == Synopsis Declared in `<baljsn_encoder.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> int encode( std::ostream& stream, TYPE const& value); ---- == Description 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. DEPRECATED: Use the `encode` function passed a reference to a non‐modifiable `EncoderOptions` object instead. == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *stream* | output stream for JSON | *value* | value to encode |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#