json5
Convert JSON5 data to JSON
TLDR
Convert JSON5 stdin to JSON stdout
Convert a JSON5 file to JSON and output to stdout
Convert a JSON5 file to the specified JSON file
Validate a JSON5 file
Specify the number of spaces to indent by (or "t" for tabs)
Display help
SYNOPSIS
json5 [options] [file]
PARAMETERS
--help
Display help message and exit.
--version
Display version information and exit.
-c, --compact
Compact output, minimizing whitespace.
-p, --parse
Parse the file, but do not format output.
-s, --space
Specify the number of spaces to use for indentation. Default is 2.
The input JSON5 file. If not specified, reads from standard input.
DESCRIPTION
The `json5` command is a versatile tool for working with JSON5 (JSON with human-friendly syntax) data from the command line. It provides functionalities similar to `jq` but specifically targets JSON5, allowing for parsing, querying, manipulating, and serializing JSON5 documents.
It can be used for tasks like extracting specific values from a configuration file, transforming data from one format to another, and validating JSON5 syntax. The command supports operations like filtering, mapping, reducing, and sorting, making it a powerful instrument for data processing within shell scripts and command-line workflows. While similar to `jq`, it offers the added benefit of handling the less strict JSON5 format, which includes features like comments and trailing commas.
ERROR HANDLING
The command returns a non-zero exit code if there are errors during parsing or processing. Check the error message on standard error for more details.