[#BloombergLP-baljsn] = xref:BloombergLP.adoc[BloombergLP]::baljsn :relfileprefix: ../ :mrdocs: Components providing JSON encoding and decoding facilities. == Types [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/ConvertFromJsonOptions.adoc[`ConvertFromJsonOptions`] | Options for converting `bdljsn::Json` objects to `bdlat`‐compliant objects. | xref:BloombergLP/baljsn/ConvertToJsonOptions.adoc[`ConvertToJsonOptions`] | Options for converting `bdlat` objects to `bdljsn::Json`. | xref:BloombergLP/baljsn/DatumDecoderOptions.adoc[`DatumDecoderOptions`] | This simply constrained (value‐semantic) attribute class specifies options for decoding `Datum` objects in the JSON format. See the section for information on the class attributes. Note that the class invariants are identically the constraints on the individual attributes. | xref:BloombergLP/baljsn/DatumEncoderOptions.adoc[`DatumEncoderOptions`] | This simply constrained (value‐semantic) attribute class specifies options for encoding `Datum` objects in the JSON format. See the section for information on the class attributes. Note that the class invariants are identically the constraints on the individual attributes. | xref:BloombergLP/baljsn/DatumUtil.adoc[`DatumUtil`] | This `struct` provides a namespace for a suite of functions that convert between a JSON formated string and a `bdld::Datum`. | xref:BloombergLP/baljsn/Decoder.adoc[`Decoder`] | This class provides a mechanism for decoding JSON data into value‐semantic objects. The `decode` methods are function templates that will decode 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 manipulating struct‐like and union‐like objects. In particular, the types generated by `bas_codegen.pl` provide the necessary interface and can be decoded using this component. | xref:BloombergLP/baljsn/DecoderOptions.adoc[`DecoderOptions`] | Options for controlling the JSON decoding process. | xref:BloombergLP/baljsn/DecoderOptionsUtil.adoc[`DecoderOptionsUtil`] | This `struct` provides a namespace for functions that set `DecoderOptions` to particular configurations. | xref:BloombergLP/baljsn/Decoder_DecodeImpProxy.adoc[`Decoder_DecodeImpProxy`] | This class provides a functor that dispatches the appropriate `decodeImp` method for a `bdeat` Dynamic type. Note that the operators provided in this `class` match the function signatures required of visitors decoding into compatible types. | xref:BloombergLP/baljsn/Decoder_ElementVisitor.adoc[`Decoder_ElementVisitor`] | This `class` implements a visitor for decoding elements within a sequence, choice, or array type. This is a component‐private class and should not be used outside of this component. Note that the operators provided in this `class` match the function signatures required of visitors decoding into elements of compatible types. | xref:BloombergLP/baljsn/Decoder_RequiredAttrsVisitor.adoc[`Decoder_RequiredAttrsVisitor`] | This class provides a functor that finds and remembers all non‐optional sequence attributes. | xref:BloombergLP/baljsn/EncodeImplUtil.adoc[`EncodeImplUtil`] | This component‐private utility `struct` provides a suite of functions that encode `bdlat` types in the JSON format. | xref:BloombergLP/baljsn/EncodeImplUtil_AttributeDispatcher.adoc[`EncodeImplUtil_AttributeDispatcher`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts an "attribute" object that satisfies one of the `bdlat` type‐category concepts, and an optional `bdlat_TypeCategory` tag type that corresponds to the attribute's `bdlat` type category. Each function‐call‐operator overload encodes a JSON representation of the specified attribute to the `formatter` supplied on construction. | xref:BloombergLP/baljsn/EncodeImplUtil_AttributeVisitor.adoc[`EncodeImplUtil_AttributeVisitor`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts an "attribute" object that satisfies one of the `bdlat` type‐category concepts, and an "attribute info" object that describes various metadata of the attribute. | xref:BloombergLP/baljsn/EncodeImplUtil_ElementDispatcher.adoc[`EncodeImplUtil_ElementDispatcher`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts an "element" object that satisfies one of the `bdlat` type‐category concepts, and an optional `bdlat_TypeCategory` tag type that corresponds to the element's `bdlat` type category. Each function‐call‐operator overload encodes a JSON representation of the specified selection to the `formatter` supplied on construction. | xref:BloombergLP/baljsn/EncodeImplUtil_ElementVisitor.adoc[`EncodeImplUtil_ElementVisitor`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts an "element" object that satisfies one of the `bdlat` type‐category concepts. | xref:BloombergLP/baljsn/EncodeImplUtil_SelectionDispatcher.adoc[`EncodeImplUtil_SelectionDispatcher`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts a "selection" object that satisfies one of the `bdlat` type‐category concepts, and an optional `bdlat_TypeCategory` tag type that corresponds to the selections's `bdlat` type category. Each function‐call‐operator overload encodes a JSON representation of the specified selection to the `formatter` supplied on construction. | xref:BloombergLP/baljsn/EncodeImplUtil_SelectionVisitor.adoc[`EncodeImplUtil_SelectionVisitor`] | This component‐private class provides a function object that closes over the `formatter`, `logStream`, and `options` parameters that are shared between all encoding operations provided in this component. The function‐call operator of this class provides an overload set that accepts a "selection" object that satisfies one of the `bdlat` type‐category concepts, and a "selection info" object that describes various metadata of the selection. | xref:BloombergLP/baljsn/EncodeImplUtil_ValueDispatcher.adoc[`EncodeImplUtil_ValueDispatcher`] | This component‐private class provides a function object used to encode values that satisfy one of the `bdlat` type‐category concepts. | xref:BloombergLP/baljsn/Encoder.adoc[`Encoder`] | 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. | xref:BloombergLP/baljsn/EncoderOptions.adoc[`EncoderOptions`] | 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. | xref:BloombergLP/baljsn/EncoderTestAddress.adoc[`EncoderTestAddress`] | Test type `EncoderTestAddress` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestChoiceWithAllCategories.adoc[`EncoderTestChoiceWithAllCategories`] | Test type `EncoderTestChoiceWithAllCategories` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestChoiceWithAllCategoriesChoice.adoc[`EncoderTestChoiceWithAllCategoriesChoice`] | Test type `EncoderTestChoiceWithAllCategoriesChoice` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestChoiceWithAllCategoriesCustomizedType.adoc[`EncoderTestChoiceWithAllCategoriesCustomizedType`] | Test type `EncoderTestChoiceWithAllCategoriesCustomizedType` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestChoiceWithAllCategoriesEnumeration.adoc[`EncoderTestChoiceWithAllCategoriesEnumeration`] | Test type `EncoderTestChoiceWithAllCategoriesEnumeration` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestChoiceWithAllCategoriesSequence.adoc[`EncoderTestChoiceWithAllCategoriesSequence`] | Test type `EncoderTestChoiceWithAllCategoriesSequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestDegenerateChoice1.adoc[`EncoderTestDegenerateChoice1`] | Test type `EncoderTestDegenerateChoice1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestDegenerateChoice1Sequence.adoc[`EncoderTestDegenerateChoice1Sequence`] | Test type `EncoderTestDegenerateChoice1Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestEmployee.adoc[`EncoderTestEmployee`] | Test type `EncoderTestEmployee` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithAllCategories.adoc[`EncoderTestSequenceWithAllCategories`] | Test type `EncoderTestSequenceWithAllCategories` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithAllCategoriesChoice.adoc[`EncoderTestSequenceWithAllCategoriesChoice`] | Test type `EncoderTestSequenceWithAllCategoriesChoice` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithAllCategoriesCustomizedType.adoc[`EncoderTestSequenceWithAllCategoriesCustomizedType`] | Test type `EncoderTestSequenceWithAllCategoriesCustomizedType` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithAllCategoriesEnumeration.adoc[`EncoderTestSequenceWithAllCategoriesEnumeration`] | Test type `EncoderTestSequenceWithAllCategoriesEnumeration` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithAllCategoriesSequence.adoc[`EncoderTestSequenceWithAllCategoriesSequence`] | Test type `EncoderTestSequenceWithAllCategoriesSequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged0.adoc[`EncoderTestSequenceWithUntagged0`] | Test type `EncoderTestSequenceWithUntagged0` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged1.adoc[`EncoderTestSequenceWithUntagged1`] | Test type `EncoderTestSequenceWithUntagged1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged10.adoc[`EncoderTestSequenceWithUntagged10`] | Test type `EncoderTestSequenceWithUntagged10` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged10Sequence.adoc[`EncoderTestSequenceWithUntagged10Sequence`] | Test type `EncoderTestSequenceWithUntagged10Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged11.adoc[`EncoderTestSequenceWithUntagged11`] | Test type `EncoderTestSequenceWithUntagged11` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged11Sequence.adoc[`EncoderTestSequenceWithUntagged11Sequence`] | Test type `EncoderTestSequenceWithUntagged11Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged11Sequence1.adoc[`EncoderTestSequenceWithUntagged11Sequence1`] | Test type `EncoderTestSequenceWithUntagged11Sequence1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged12.adoc[`EncoderTestSequenceWithUntagged12`] | Test type `EncoderTestSequenceWithUntagged12` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged12Sequence.adoc[`EncoderTestSequenceWithUntagged12Sequence`] | Test type `EncoderTestSequenceWithUntagged12Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged13.adoc[`EncoderTestSequenceWithUntagged13`] | Test type `EncoderTestSequenceWithUntagged13` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged13Sequence.adoc[`EncoderTestSequenceWithUntagged13Sequence`] | Test type `EncoderTestSequenceWithUntagged13Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged14.adoc[`EncoderTestSequenceWithUntagged14`] | Test type `EncoderTestSequenceWithUntagged14` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged1Sequence.adoc[`EncoderTestSequenceWithUntagged1Sequence`] | Test type `EncoderTestSequenceWithUntagged1Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged2.adoc[`EncoderTestSequenceWithUntagged2`] | Test type `EncoderTestSequenceWithUntagged2` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged3.adoc[`EncoderTestSequenceWithUntagged3`] | Test type `EncoderTestSequenceWithUntagged3` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged3Sequence.adoc[`EncoderTestSequenceWithUntagged3Sequence`] | Test type `EncoderTestSequenceWithUntagged3Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged3Sequence1.adoc[`EncoderTestSequenceWithUntagged3Sequence1`] | Test type `EncoderTestSequenceWithUntagged3Sequence1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged4.adoc[`EncoderTestSequenceWithUntagged4`] | Test type `EncoderTestSequenceWithUntagged4` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged4Sequence.adoc[`EncoderTestSequenceWithUntagged4Sequence`] | Test type `EncoderTestSequenceWithUntagged4Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged5.adoc[`EncoderTestSequenceWithUntagged5`] | Test type `EncoderTestSequenceWithUntagged5` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged5Sequence.adoc[`EncoderTestSequenceWithUntagged5Sequence`] | Test type `EncoderTestSequenceWithUntagged5Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged6.adoc[`EncoderTestSequenceWithUntagged6`] | Test type `EncoderTestSequenceWithUntagged6` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged7.adoc[`EncoderTestSequenceWithUntagged7`] | Test type `EncoderTestSequenceWithUntagged7` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged7Sequence.adoc[`EncoderTestSequenceWithUntagged7Sequence`] | Test type `EncoderTestSequenceWithUntagged7Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged7Sequence1.adoc[`EncoderTestSequenceWithUntagged7Sequence1`] | Test type `EncoderTestSequenceWithUntagged7Sequence1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged7Sequence2.adoc[`EncoderTestSequenceWithUntagged7Sequence2`] | Test type `EncoderTestSequenceWithUntagged7Sequence2` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged8.adoc[`EncoderTestSequenceWithUntagged8`] | Test type `EncoderTestSequenceWithUntagged8` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged8Sequence.adoc[`EncoderTestSequenceWithUntagged8Sequence`] | Test type `EncoderTestSequenceWithUntagged8Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged8Sequence1.adoc[`EncoderTestSequenceWithUntagged8Sequence1`] | Test type `EncoderTestSequenceWithUntagged8Sequence1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged9.adoc[`EncoderTestSequenceWithUntagged9`] | Test type `EncoderTestSequenceWithUntagged9` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged9Sequence.adoc[`EncoderTestSequenceWithUntagged9Sequence`] | Test type `EncoderTestSequenceWithUntagged9Sequence` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/EncoderTestSequenceWithUntagged9Sequence1.adoc[`EncoderTestSequenceWithUntagged9Sequence1`] | Test type `EncoderTestSequenceWithUntagged9Sequence1` used by `baljsn` encoder tests. | xref:BloombergLP/baljsn/Encoder_Formatter.adoc[`Encoder_Formatter`] | This class implements a formatter providing operations for rending JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction). This is a component‐private class and should not be used outside of this component. | xref:BloombergLP/baljsn/EncodingStyle.adoc[`EncodingStyle`] | Enumeration of encoding style (COMPACT or PRETTY). | xref:BloombergLP/baljsn/Formatter.adoc[`Formatter`] | This class implements a formatter providing operations for rendering JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction). | xref:BloombergLP/baljsn/JsonConverter.adoc[`JsonConverter`] | This class provides a mechanism for copying the constituent values of certain `bdlat`‐compatible objects to `bdljsn::Json` objects, and vice versa. In each case, the resulting object is a different representation of the data in the original. This conversion is analogous to the encoding and decoding operations provided elsewhere in this package; however, the `convert` methods here avoid the creation of any textual representation of the data. | xref:BloombergLP/baljsn/JsonConverter_DecodeImpProxy.adoc[`JsonConverter_DecodeImpProxy`] | This class provides a functor that dispatches the appropriate `decodeImp` method for a `bdeat` Dynamic type. Note that the operators provided in this `class` match the function signatures required of visitors decoding into compatible types. | xref:BloombergLP/baljsn/JsonConverter_ElementVisitor.adoc[`JsonConverter_ElementVisitor`] | This `class` implements a visitor for decoding elements within a sequence, choice, or array type. This is a component‐private class and should not be used outside of this component. Note that the operators provided in this `class` match the function signatures required of visitors decoding into elements of compatible types. | xref:BloombergLP/baljsn/JsonFormatter.adoc[`JsonFormatter`] | This class implements a formatter mechanism that assembles a (potentially complicated) `bdljsn::Json` object according to the invocations of the formatter's manipulators. | xref:BloombergLP/baljsn/JsonFormatter_State.adoc[`JsonFormatter_State`] | This `struct` defines an enumeration of the internal states that a a `JsonFormatter` can reach as it processes user requests to `openArray`, `putValue`(s), `closeArray`, etc. These states influence the formatter and, in some build modes, detect errors in call sequences. | xref:BloombergLP/baljsn/JsonFormatter_Util.adoc[`JsonFormatter_Util`] | Utilities supporting `JsonFormatter` encoding operations. | xref:BloombergLP/baljsn/JsonParserUtil.adoc[`JsonParserUtil`] | This class provides utility functions for decoding data in the JSONformat into a `bdeat` Simple type. The primary method is `getValue`,which decodes into a specified object and is overloaded for all `bdeat`Simple types. | xref:BloombergLP/baljsn/JsonTokenizer.adoc[`JsonTokenizer`] | This class implements a mechanism that makes the organization and values of a non‐scalar `bdljsn::Json` object available as a series of tokens. Some tokens have associated values. See . | xref:BloombergLP/baljsn/JsonTokenizer_Visitor.adoc[`JsonTokenizer_Visitor`] | This class provides a mechanism for extracting token information from a `bdljsn::Json` object, transferring that information to a parent `baljsn::JsonTokenizer` object (which considers this visitor a `friend`), and, if appropriate, arranging for the visiting of a subordinate `bdljsn::Json` object. | xref:BloombergLP/baljsn/ParserUtil.adoc[`ParserUtil`] | This class provides utility functions for decoding data in the JSONformat into a `bdlat` Simple type. The primary method is `getValue`,which decodes into a specified object and is overloaded for all `bdlat`Simple types. | xref:BloombergLP/baljsn/PrintUtil.adoc[`PrintUtil`] | This `struct` provides functions for printing objects to output streams in JSON format. | xref:BloombergLP/baljsn/SimpleFormatter.adoc[`SimpleFormatter`] | This class implements a formatter providing operations for rendering JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction). |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/Tokenizer.adoc[`Tokenizer`] | Alias for `bdljsn::Tokenizer`. |=== == Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/hashAppend-0eb.adoc[`hashAppend`] | `hashAppend` overloads | xref:BloombergLP/baljsn/operator_lshift-04d2.adoc[`operator<<`] | Stream insertion operators | xref:BloombergLP/baljsn/operator_eq-063.adoc[`operator==`] | Equality operators | xref:BloombergLP/baljsn/operator_not_eq-07be.adoc[`operator!=`] | Inequality operators |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#