LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

json5

parses JSON5 format and outputs standard JSON

TLDR

Parse JSON5 to JSON
$ json5 [file.json5]
copy
Convert from stdin
$ echo '{name: "test"}' | json5
copy
Pretty print
$ json5 --space [2] [file.json5]
copy
Validate only
$ json5 --validate [file.json5]
copy
Indent with tabs
$ json5 --space t [file.json5]
copy
Convert and write to file
$ json5 --out-file [output.json] [file.json5]
copy

SYNOPSIS

json5 [options] [file]

DESCRIPTION

json5 parses JSON5 format and outputs standard JSON. JSON5 extends JSON with comments, trailing commas, and unquoted keys.The tool converts more readable JSON5 configs to strict JSON. It validates and formats JSON5 input.

PARAMETERS

FILE

JSON5 file to parse. Reads from stdin if omitted.
-s, --space N
Number of spaces to indent, or "t" for tabs.
-v, --validate
Validate JSON5 syntax without outputting JSON.
-o, --out-file FILE
Write output to file instead of stdout.
-V, --version
Display version number.
-h, --help
Display help information.

CAVEATS

Node.js tool. JSON5 is a superset of JSON. Output is standard JSON.

HISTORY

json5 implements the JSON5 specification, designed to make JSON more human-friendly for configuration files.

SEE ALSO

jq(1), json_pp(1), jsonlint(1)

Copied to clipboard
Kai