pyjson51
Formatter for json5 documents
Usage
json5 [-h]
[-V]
[-c
STR]
[--as-json]
[--indent
INDENT]
[--quote-keys]
[--no-quote-keys]
[--trailing-commas]
[--no-trailing-commas]
[FILE]
Overview
A tool to parse and pretty-print JSON5.
Options
positional arguments:
- FILE
-
optional file to read JSON5 document from; if not specified or "-", will read from stdin instead
options:
-
-h, --help -
show this help message and exit
-
-V, --version -
print the version and exit
-
-c STR -
inline json5 string to read instead of reading from a file
-
--as-json -
output as JSON (same as
--quote-keys--no-trailingcommas)
-
--indent INDENT -
amount to indent each line (default is 4 spaces)
-
--quote-keys -
quote all object keys
-
--no-quote-keys -
don't quote object keys that are identifiers (this is the default)
-
--trailing-commas -
add commas after the last item in multi-line objects and arrays (this is the default)
-
--no-trailing-commas -
do not add commas after the last item in multi-line lists and objects
Examples
- $ echo '{foo:"bar"}' | pyjson5
-
{
-
foo: 'bar',
-
}
- $ echo '{foo:"bar"}' | pyjson5 --as-json
-
{
-
"foo": "bar"
-
}