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

This component&hyphen;private utility `struct` provides a suite of functions that encode `bdlat` types in the JSON format&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FORMATTER&gt;
struct EncodeImplUtil;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/EncodeImplUtil/FormattingMode.adoc[`FormattingMode`] 
| `FormattingMode` is an alias to the type of an `int`&hyphen;valued `bdlat&lowbar;FormattingMode` bit&hyphen;field&period; A `FormattingMode` value is not valid unless it is equal to an enumerator of `bdlat&lowbar;FormattingMode` or a valid bitwise&hyphen;or of two or more such enumerators&period; See `bdlat&lowbar;formattingmode` for a description of the set of valid formatting&hyphen;mode values&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/ThisUtil.adoc[`ThisUtil`] 
| `ThisUtil` is a convenience alias for this utility `struct`&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/EncodeImplUtil/closeDocument.adoc[`closeDocument`] 
| Print the sequence of characters that designate the end of a JSON document to the specified `outputStream` according to the specified encoding `options`&period; See the `baljsn&lowbar;encoderoptions` for a description of the effects, if any, of each option in the `options` on the end of a JSON document&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encode-0a.adoc[`encode`] 
| `encode` overloads
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeCharArray.adoc[`encodeCharArray`] 
| Encode the JSON representation of the specified `value` to the specified JSON `formatter`&period; Use the specified `options` to configure aspects of the JSON representation of the `value`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeEmptyArray.adoc[`encodeEmptyArray`] 
| Encode the representation of the empty&hyphen;array JSON value to the specified `formatter`&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeMember-04.adoc[`encodeMember`] 
| `encodeMember` overloads
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeMemberPrefix-03.adoc[`encodeMemberPrefix`] 
| `encodeMemberPrefix` overloads
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeNonEmptyArray.adoc[`encodeNonEmptyArray`] 
| Encode the JSON representation of the specified `value` to the specified JSON `formatter`&period; Use the specified `options` to configure aspects of the JSON representation of the `value`&period; If this operation is not successful, load an unspecified, human&hyphen;readable description of the error condition to the specified `logStream`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The behavior is undefined unless the `value` is non&hyphen;empty and the specified `TYPE` satisfies both the static and dynamic requirements of the `Array` `bdlat` type&hyphen;category concept&period; See `baljsn&lowbar;encoderoptions` for a description of the effects, if any, of each option in the `options` on the JSON representation of the `selection`&period; See the package&hyphen;level documentation of `bdlat` for an introduction to the requirements of `bdlat` type&hyphen;category concepts&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeObjectPrefix.adoc[`encodeObjectPrefix`] 
| If the specified `formattingMode` does not have the `bdlat&lowbar;FormattingMode&colon;&colon;e&lowbar;UNTAGGED` bit set, encode a &quot;left brace&quot; JSON token to the specified `formatter`, and encoding nothing to the `formatter` otherwise&period; If this operation encodes a token to the formatter, load the value `false` to the specified `isPrefixEmpty`, and the value `true` otherwise&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeObjectSuffix.adoc[`encodeObjectSuffix`] 
| If the specified `formattingMode` does not have the `bdlat&lowbar;FormattingMode&colon;&colon;e&lowbar;UNTAGGED` bit set, encode a &quot;right brace&quot; JSON token to the specified `formatter`, and encoding nothing to the `formatter` otherwise&period; If this operation encodes a token to the `formatter`, load the value `false` to the specified `isSuffixEmpty`, and the value `true` otherwise&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/encodeSimpleValue.adoc[`encodeSimpleValue`] 
| Encode the JSON representation of the specified `value` to the specified JSON `formatter`&period; Use the specified `options` to configure aspects of the JSON representation of the `value`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The behavior is undefined unless the specified `TYPE` satisfies both the static and dynamic requirements of the `Simple` `bdlat` type&hyphen;category concept&period; See `baljsn&lowbar;encoderoptions` for a description of the effects, if any, of each option in the `options` on the JSON representation of the `value`&period; See the package&hyphen;level documentation of `bdlat` for an introduction to the requirements of `bdlat` type&hyphen;category concepts&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/openDocument.adoc[`openDocument`] 
| Print the sequence of characters that designate the start of a JSON document to the specified `outputStream` according to the specified encoding `options`&period; See `baljsn&lowbar;encoderoptions` for a description of the effects, if any, of each option in the `options` on the start of a JSON document&period;
| xref:BloombergLP/baljsn/EncodeImplUtil/validate-0f.adoc[`validate`] 
| `validate` overloads
| xref:BloombergLP/baljsn/EncodeImplUtil/validateChoice.adoc[`validateChoice`] 
| Determine if the specified `value` satisfies the requirements for encoding using this component&period; If the `value` meets the encoding requirements, return 0, otherwise load an unspecified, human&hyphen;readable description of the requirements that are not satisfied by the `value` to the specified `logStream` and return a non&hyphen;zero value&period; The `value` is required to not have an undefined `selectionId`&period;
|===



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