Fast JSON formatter and validator for the command line. Written in Go for speed — handles large files without breaking a sweat.
go install github.com/himalaya0x/jsonfmt@latestOr build from source:
git clone https://github.com/himalaya0x/jsonfmt.git
cd jsonfmt
go build -o jsonfmt .# Format a file
jsonfmt data.json
# Format from stdin
cat data.json | jsonfmt
curl -s https://api.example.com/data | jsonfmt
# Validate only (no output, exit code 0 or 1)
jsonfmt --validate data.json
# Compact (remove whitespace)
jsonfmt --compact data.json
# Custom indent
jsonfmt --indent 4 data.json
# In-place formatting
jsonfmt --write data.json
# Sort keys
jsonfmt --sort data.json- Formats and validates JSON from files or stdin
- Compact mode for minification
- In-place file editing with
--write - Alphabetical key sorting
- Configurable indentation (default: 2 spaces)
- Fast — processes 100MB+ files in under a second
- Zero dependencies beyond the Go standard library
MIT