DAW JSON Link
|
daw::json::to_json
allows optional policy flags to control the output. The defaults are specified below under Format Policy Flags. All the enum's below are in the daw::json::options
namespace
The example below shows output with the defaults and with Pretty formatting enabled. To see a working example using this code, refer to cookbook_output_flags1_test.cpp
The program will output
Enable or disable formatted output
Minified
- Output the minimal JSON documentPretty
- Use newlines and indentation to format JSON documentMinified
Control how the file is indented
Tab
- use tab character for indentationSpace1
- Indent 1 spaceSpace2
- Indent 2 spacesSpace3
- Indent 3 spacesSpace4
- Indent 4 spacesSpace5
- Indent 5 spacesSpace8
- Indent 8 spacesSpace10
- Indent 10 spaces :) https://youtu.be/SsoOG6ZeyUISpace2
Allow for a JSON document that is ASCII only and each byte has a value <= 0x7F
None
- Do not restrict to 7bit ASCIIOnlyAllow7bitStrings
- Restrict all string member values and all member names to 7bits, escaping all values >= 0x7F.ErrorInvalidUTF8
- Throw an error when invalid UTF8 is encounteredErrorInvalidUTF8
Change how newlines are delimited
n
- Use \n
to delimit newlinesrn
- Use \r\n
to delimit newlinesn
With arrays/classes output optionally output a trailing comma
No
- Do not output trailing comma's. This is conformantYes
- Add non-conformant trailing commas to array elements and class membersNo