HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

json5 — Convert JSON5 files to JSON. More information: <https://json5.org/#cli>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
json5commandfilesconvertclijsonmore

Problem

How to use the json5 command: Convert JSON5 files to JSON. More information: <https://json5.org/#cli>.

Solution

json5 — Convert JSON5 files to JSON. More information: <https://json5.org/#cli>.

Convert JSON5 stdin to JSON stdout:
echo {{input}} | json5


Convert a JSON5 file to JSON and output to stdout:
json5 {{path/to/input_file.json5}}


Convert a JSON5 file to the specified JSON file:
json5 {{path/to/input_file.json5}} {{[-o|--out-file]}} {{path/to/output_file.json}}


Validate a JSON5 file:
json5 {{path/to/input_file.json5}} {{[-v|--validate]}}


Specify the number of spaces to indent by (or "t" for tabs):
json5 {{[-s|--space]}} {{indent_amount}}


Display help:
json5 {{[-h|--help]}}

Code Snippets

Convert JSON5 `stdin` to JSON `stdout`

echo {{input}} | json5

Convert a JSON5 file to JSON and output to `stdout`

json5 {{path/to/input_file.json5}}

Convert a JSON5 file to the specified JSON file

json5 {{path/to/input_file.json5}} {{[-o|--out-file]}} {{path/to/output_file.json}}

Validate a JSON5 file

json5 {{path/to/input_file.json5}} {{[-v|--validate]}}

Specify the number of spaces to indent by (or "t" for tabs)

json5 {{[-s|--space]}} {{indent_amount}}

Context

tldr-pages: common/json5

Revisions (0)

No revisions yet.