BDE 4.14.0 Production release
|
Provide options for writing a JSON document.
This component provides a single, simply constrained (value-semantic) attribute class, bdljsn::WriteOptions
, that is used to specify options for writing a JSON document (see bdljsn_jsonutil ).
initialIndentLevel
: initial indent level for the top-most element. If style
is e_COMPACT
, or spacesPerLevel
is 0, this option is ignored.sortMembers
: indicates whether the members of a object will be sorted in lexicographical order based on the member name.spacesPerLevel
: spaces per indent level. If this option is 0, no indentation is used. If style
is e_COMPACT
or e_ONELINE
, this option is ignored.style
: the style used to encode the JSON data.This section illustrates intended use of this component.
This component is designed to be used at a higher level to set the options for writing bdljsn::Json
objects in JSON format. This example shows how to create and populate an options object.
First, we default-construct a bdljsn::WriteOptions
object:
Finally, we populate that object using a pre-defined initial indent level and spaces per level: