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.
Declared in <baljsn_encoder.h>
class Encoder;
| Name | Description |
|---|---|
Encoder [constructor] | Create a encoder object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. |
encode | encode overloads |
encodeAny | encodeAny overloads |
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. |