jsonlint
Validate JSON data syntax and format
SYNOPSIS
jsonlint [-c|--compact] [-q|--quiet] [-b|--blank] [FILE|-]
PARAMETERS
-c, --compact
Output compact JSON without whitespace instead of pretty-printing.
-q, --quiet
Quiet mode: suppress output, exit 0 if valid JSON, 1 if invalid.
-b, --blank
Check only if input JSON is blank (empty object/array).
-h, --help
Display help and usage information.
-v, --version
Show the jsonlint version.
DESCRIPTION
jsonlint is a lightweight command-line tool for validating and linting JSON files or input. It parses JSON from files or standard input (stdin), checks for syntax errors, and reports issues with precise line and column numbers. If valid, it can pretty-print the JSON in a formatted way or output in compact form. Primarily used for scripting, CI/CD pipelines, and quick JSON checks without a full editor.
Installation requires Node.js and npm: run npm install -g jsonlint. Once installed, it's available system-wide. It supports multiple files and exits with code 0 for valid JSON, 1 for invalid, making it ideal for automation. Unlike heavier tools, it's fast and focused solely on validation and formatting, without querying or transforming data.
CAVEATS
Requires Node.js/npm installation; not in standard distro repos. Reads stdin if no FILE given. Limited to syntax validation—no data querying.
INSTALLATION
npm install -g jsonlint
Verify: jsonlint --version
EXAMPLES
jsonlint file.json — validate and pretty-print.
echo '{"key":1}' | jsonlint -q — quiet stdin check.
jsonlint -c *.json — compact validate multiple files.
HISTORY
Developed by Zachary Carter as a Node.js module; first npm release in 2012. Popular for shell scripting; maintained with minor updates for Node compatibility.
SEE ALSO
jq(1)


