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

This class provides a mechanism for encoding value&hyphen;semantic objects in the JSON format&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Encoder;
----

== Description

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&lowbar;sequencefunctions`, `bdlat&lowbar;choicefunctions`, and `bdlat&lowbar;choicefunctions` components respectively&period; These generic frameworks provide a common compile&hyphen;time interface for accessing struct&hyphen;like and union&hyphen;like objects&period; In particular, the types generated by `bas&lowbar;codegen&period;pl` provide the necessary interface and can be encoded using this component&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/Encoder/2constructor.adoc[`Encoder`]         [.small]#[constructor]#
| Create a encoder object&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period;
| 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 messages logged during the last call to the `encode` method&period;
|===



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