Enumerate the formatting styles for a writing a JSON document.
More...
Detailed Description
- Outline
-
-
- Purpose:
- Enumerate the formatting styles for a writing a JSON document.
-
- Classes:
-
- See also:
- Component bdljsn_writeoptions
-
- Description:
- This component provides
bdljsn::WriteStyle
, a namespace for the enum
type bdljsn::WriteStyle::Enum
, which enumerates the set of format styles that can be used when writing a JSON document.
-
- Enumerators:
Name Description
------------- -------------------------------------------------------
e_PRETTY A human friendly format with configurable new lines and
indentation
e_ONELINE A single-line format with a space after each comma and
colon.
e_COMPACT A maximally compact format with no white space.
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Basic Syntax:
- The following snippets of code provide a simple illustration of using
bdljsn::WriteStyle
.
- First, we create a variable
value
of type bdljsn::WriteStyle::Enum
and initialize it with the enumerator value bdljsn::WriteStyle::e_PRETTY
: Now, we store the address of its ASCII representation in a pointer variable, asciiValue
, of type const char *
: Finally, we print value
to bsl::cout
. bsl::cout << value << bsl::endl;
This statement produces the following output on stdout
: