Added a "strict JSON" mode to the text generator and compiler

This will add quotes around field names, as required by the official
standard. By default it will leave quotes out, as it is more readable,
more compact, and is accepted by almost all JSON parsers.
The -S switch to flatc turns on strict mode.

As per rfc 7159.

Change-Id: Ibabe9c8162c47339d00ec581d18721a2ba40c6d0
Tested: on Windows.
This commit is contained in:
Wouter van Oortmerssen
2014-07-08 16:35:14 -07:00
parent 9140144d51
commit 7fcbe723fc
11 changed files with 94 additions and 50 deletions

View File

@@ -2,7 +2,7 @@
Usage:
flatc [ -c ] [ -j ] [ -b ] [ -t ] file1 file2 ..
flatc [ -c ] [ -j ] [ -b ] [ -t ] [ -o PATH ] [ -S ] file1 file2 ..
The files are read and parsed in order, and can contain either schemas
or data (see below). Later files can make use of definitions in earlier
@@ -20,3 +20,10 @@ be generated for each file processed:
- `-t` : If data is contained in this file, generate a
`filename_wire.txt` (for debugging).
- `-o PATH` : Output all generated files to PATH (either absolute, or
relative to the current directory). If omitted, PATH will be the
current directory. PATH should end in your systems path separator,
e.g. `/` or `\`.
- `-S` : Generate strict JSON (field names are enclosed in quotes).
By default, no quotes are generated.