[#BloombergLP-baljsn-Encoder] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::Encoder :relfileprefix: ../../ :mrdocs: This class provides a mechanism for encoding value‐semantic objects in the JSON format. The `encode` methods are function templates that will encode any object that meets the requirements of a sequence, choice, or array object as defined in the `bdlat_sequencefunctions`, `bdlat_choicefunctions`, and `bdlat_choicefunctions` components respectively. These generic frameworks provide a common compile‐time interface for accessing struct‐like and union‐like objects. In particular, the types generated by `bas_codegen.pl` provide the necessary interface and can be encoded using this component. == Synopsis Declared in `<baljsn_encoder.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Encoder; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/Encoder/2constructor.adoc[`Encoder`] [.small]#[constructor]# | Create a encoder object. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is 0, the currently installed default allocator is used. | xref:BloombergLP/baljsn/Encoder/encode-0a.adoc[`encode`] | `encode` overloads | xref:BloombergLP/baljsn/Encoder/encodeAny-07.adoc[`encodeAny`] | `encodeAny` overloads | xref:BloombergLP/baljsn/Encoder/loggedMessages.adoc[`loggedMessages`] | Return a string containing any error, warning, or trace messages that were logged during the last call to the `encode` method. The log is reset each time `encode` is called. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#