LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jsonlint

validates and formats JSON files

TLDR

Validate JSON file
$ jsonlint [file.json]
copy
Validate with quiet mode
$ jsonlint -q [file.json]
copy
Validate and format
$ jsonlint -i [file.json]
copy
Compact output
$ jsonlint -c [file.json]
copy
Sort keys
$ jsonlint -s [file.json]
copy
Validate multiple files
$ jsonlint [file1.json] [file2.json]
copy

SYNOPSIS

jsonlint [options] [files...]

DESCRIPTION

jsonlint validates and formats JSON files. It checks for syntax errors and can pretty-print or compact JSON data.The tool is useful for validating configuration files, API responses, and data files. It provides clear error messages for malformed JSON.

PARAMETERS

-q, --quiet

No output, just exit code.
-c, --compact
Compact output.
-i, --in-place
Format and overwrite file.
-s, --sort-keys
Sort object keys.
-t chars
Tab characters for indent.
-e env
Use environment for input.
-p, --pretty-print
Pretty print output.
-V, --validate
Validate only, no output.

VALIDATION ERRORS

$ $ jsonlint bad.json
Error: Parse error on line 3:
...  "name": "test"  "value": 42
---------------------^
Expecting 'EOF', '}', ',', ']', got 'STRING'
copy

INSTALL

brew install jsonlint
copy

CAVEATS

Multiple implementations exist (Node.js, Python). Doesn't validate against JSON Schema. Comments not supported (per JSON spec).

HISTORY

Various jsonlint implementations exist. The concept originated from JavaScript linting tools. Popular implementations include the npm jsonlint package by Zach Carter.

SEE ALSO

jq(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid