[#BloombergLP-baljsn-EncoderOptions] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::EncoderOptions :relfileprefix: ../../ :mrdocs: Options for performing JSON encoding. `EncodingStyle` is either `COMPACT` or `PRETTY`. If `EncodingStyle` is `COMPACT`, no whitespace will be added between elements. If encoding style is `PRETTY`, then the `InitialIndentLevel` and `SpacesPerLevel` parameters are used to specify the formatting of the output. Note that `InitialIndentLevel` and `SpacesPerLevel` are ignored when `EncodingStyle` is `COMPACT` (this is the default). The `EncodeEmptyArrays` and `EncodeNullElements` encode empty array and null elements respectively. By default empty array and null elements are not encoded. The `EncodeInfAndNaNAsStrings` attribute provides users the option to encode `Infinity` and `NaN` floating point values as strings. These values do not have a valid JSON representation and by default such value will result in an encoding error. The `DatetimeFractionalSecondPrecision` specifies the precision of milliseconds printed with date time values. By default a precision of `3` decimal places is used. The `MaxFloatPrecision` and `MaxDoublePrecision` attributes allow specifying the maximum precision for `float` and `double` values. When not specified, or 0 is specified, the precision is determined automatically to use enough digits to ensure restoring the original binary floating point value by a reader. We recommend against setting these options: they were provided prior to the current default behavior (of choosing the shortest presentation that can be restored to the original value) being available. == Synopsis Declared in `<baljsn_encoderoptions.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class EncoderOptions; ---- == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/EncoderOptions/_04enum-07.adoc[`Unnamed enum`] | Attribute identifier constants. | xref:BloombergLP/baljsn/EncoderOptions/_04enum-0e.adoc[`Unnamed enum`] | Attribute count constants. | xref:BloombergLP/baljsn/EncoderOptions/_04enum-09.adoc[`Unnamed enum`] | Attribute index constants. | xref:BloombergLP/baljsn/EncoderOptions/EncodingStyle-0f.adoc[`EncodingStyle`] | This `enum` provides enumerators to specify the encoding styles. This `enum` is replicated in this `class` for backwards‐compatibility with `baejsn`. Users should use `baljsn::EncodingStyle` directly. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/EncoderOptions/2constructor-02.adoc[`EncoderOptions`] [.small]#[constructor]# | Constructors | xref:BloombergLP/baljsn/EncoderOptions/2destructor.adoc[`~EncoderOptions`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/baljsn/EncoderOptions/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs` object. | xref:BloombergLP/baljsn/EncoderOptions/accessAttribute-02.adoc[`accessAttribute`] | `accessAttribute` overloads | xref:BloombergLP/baljsn/EncoderOptions/accessAttributes.adoc[`accessAttributes`] | Invoke the specified `accessor` sequentially on each (non‐modifiable) attribute of this object, supplying `accessor` with the corresponding attribute information structure until such invocation returns a non‐zero value. Return the value from the last invocation of `accessor` (i.e., the invocation that terminated the sequence). | xref:BloombergLP/baljsn/EncoderOptions/datetimeFractionalSecondPrecision.adoc[`datetimeFractionalSecondPrecision`] | Return a reference to the non‐modifiable "DatetimeFractionalSecondPrecision" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/encodeAnonSequenceInChoice.adoc[`encodeAnonSequenceInChoice`] | Return the value of the "EncodeAnonSequenceInChoice" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/encodeEmptyArrays.adoc[`encodeEmptyArrays`] | Return a reference to the non‐modifiable "EncodeEmptyArrays" attribute of this object. Note that empty arrays occurring as selections of choices are always encoded regardless of the setting of this option. | xref:BloombergLP/baljsn/EncoderOptions/encodeInfAndNaNAsStrings.adoc[`encodeInfAndNaNAsStrings`] | Return a reference to the non‐modifiable "EncodeInfAndNaNAsStrings" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/encodeNullElements.adoc[`encodeNullElements`] | Return a reference to the non‐modifiable "EncodeNullElements" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/encodeQuotedDecimal64.adoc[`encodeQuotedDecimal64`] | Return the value of the "EncodeQuotedDecimal64" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/encodingStyle-04.adoc[`encodingStyle`] | Return a reference to the non‐modifiable "EncodingStyle" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/escapeForwardSlash.adoc[`escapeForwardSlash`] | Return the value of the "EscapeForwardSlash" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/initialIndentLevel.adoc[`initialIndentLevel`] | Return a reference to the non‐modifiable "InitialIndentLevel" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/manipulateAttribute-03.adoc[`manipulateAttribute`] | `manipulateAttribute` overloads | xref:BloombergLP/baljsn/EncoderOptions/manipulateAttributes.adoc[`manipulateAttributes`] | Invoke the specified `manipulator` sequentially on the address of each (modifiable) attribute of this object, supplying `manipulator` with the corresponding attribute information structure until such invocation returns a non‐zero value. Return the value from the last invocation of `manipulator` (i.e., the invocation that terminated the sequence). | xref:BloombergLP/baljsn/EncoderOptions/maxDoublePrecision.adoc[`maxDoublePrecision`] | Return a reference to the non‐modifiable "MaxDoublePrecision" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/maxFloatPrecision.adoc[`maxFloatPrecision`] | Return a reference to the non‐modifiable "MaxFloatPrecision" attribute of this object. | xref:BloombergLP/baljsn/EncoderOptions/print.adoc[`print`] | Format this object to the specified output `stream` at the optionally specified indentation `level` and return a reference to the modifiable `stream`. If `level` is specified, optionally specify `spacesPerLevel`, the number of spaces per indentation level for this and all of its nested objects. Each line is indented by the absolute value of `level * spacesPerLevel`. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, suppress line breaks and format the entire output on one line. If `stream` is initially invalid, this operation has no effect. Note that a trailing newline is provided in multiline mode only. | xref:BloombergLP/baljsn/EncoderOptions/reset.adoc[`reset`] | Reset this object to the default value (i.e., its value upon default construction). | xref:BloombergLP/baljsn/EncoderOptions/setDatetimeFractionalSecondPrecision.adoc[`setDatetimeFractionalSecondPrecision`] | Set the "DatetimeFractionalSecondPrecision" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodeAnonSequenceInChoice.adoc[`setEncodeAnonSequenceInChoice`] | Set the "EncodeAnonSequenceInChoice" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodeEmptyArrays.adoc[`setEncodeEmptyArrays`] | Set the "EncodeEmptyArrays" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodeInfAndNaNAsStrings.adoc[`setEncodeInfAndNaNAsStrings`] | Set the "EncodeInfAndNaNAsStrings" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodeNullElements.adoc[`setEncodeNullElements`] | Set the "EncodeNullElements" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodeQuotedDecimal64.adoc[`setEncodeQuotedDecimal64`] | Set the "EncodeQuotedDecimal64" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setEncodingStyle-04.adoc[`setEncodingStyle`] | `setEncodingStyle` overloads | xref:BloombergLP/baljsn/EncoderOptions/setEscapeForwardSlash.adoc[`setEscapeForwardSlash`] | Set the "EscapeForwardSlash" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setInitialIndentLevel.adoc[`setInitialIndentLevel`] | Set the "InitialIndentLevel" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setMaxDoublePrecision.adoc[`setMaxDoublePrecision`] | Set the "MaxDoublePrecision" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setMaxFloatPrecision.adoc[`setMaxFloatPrecision`] | Set the "MaxFloatPrecision" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/setSpacesPerLevel.adoc[`setSpacesPerLevel`] | Set the "SpacesPerLevel" attribute of this object to the specified `value`. | xref:BloombergLP/baljsn/EncoderOptions/spacesPerLevel.adoc[`spacesPerLevel`] | Return a reference to the non‐modifiable "SpacesPerLevel" attribute of this object. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/EncoderOptions/lookupAttributeInfo-02.adoc[`lookupAttributeInfo`] | `lookupAttributeInfo` overloads |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/EncoderOptions/ATTRIBUTE_INFO_ARRAY.adoc[`ATTRIBUTE_INFO_ARRAY`] | Attribute metadata for this options type. | xref:BloombergLP/baljsn/EncoderOptions/CLASS_NAME.adoc[`CLASS_NAME`] | Name of this class. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION.adoc[`DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION`] | Default value for the `datetimeFractionalSecondPrecision` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODE_ANON_SEQUENCE_IN_CHOICE.adoc[`DEFAULT_INITIALIZER_ENCODE_ANON_SEQUENCE_IN_CHOICE`] | Default value for the `encodeAnonSequenceInChoice` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODE_EMPTY_ARRAYS.adoc[`DEFAULT_INITIALIZER_ENCODE_EMPTY_ARRAYS`] | Default value for the `encodeEmptyArrays` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODE_INF_AND_NA_N_AS_STRINGS.adoc[`DEFAULT_INITIALIZER_ENCODE_INF_AND_NA_N_AS_STRINGS`] | Default value for the `encodeInfAndNaNAsStrings` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODE_NULL_ELEMENTS.adoc[`DEFAULT_INITIALIZER_ENCODE_NULL_ELEMENTS`] | Default value for the `encodeNullElements` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODE_QUOTED_DECIMAL64.adoc[`DEFAULT_INITIALIZER_ENCODE_QUOTED_DECIMAL64`] | Default value for the `encodeQuotedDecimal64` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ENCODING_STYLE.adoc[`DEFAULT_INITIALIZER_ENCODING_STYLE`] | Default value for the `encodingStyle` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH.adoc[`DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH`] | Default value for the `escapeForwardSlash` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL.adoc[`DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL`] | Default value for the `initialIndentLevel` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_MAX_DOUBLE_PRECISION.adoc[`DEFAULT_INITIALIZER_MAX_DOUBLE_PRECISION`] | Default value for the `maxDoublePrecision` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_MAX_FLOAT_PRECISION.adoc[`DEFAULT_INITIALIZER_MAX_FLOAT_PRECISION`] | Default value for the `maxFloatPrecision` attribute. | xref:BloombergLP/baljsn/EncoderOptions/DEFAULT_INITIALIZER_SPACES_PER_LEVEL.adoc[`DEFAULT_INITIALIZER_SPACES_PER_LEVEL`] | Default value for the `spacesPerLevel` attribute. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/operator_not_eq-085.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` attribute objects do not have the same value, and `false` otherwise. Two attribute objects do not have the same value if one or more respective attributes differ in values. | xref:BloombergLP/baljsn/operator_eq-060.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` attribute objects have the same value, and `false` otherwise. Two attribute objects have the same value if each respective attribute has the same value. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#