Skip to content
/ jsonfmt Public

Fast JSON formatter and validator for the command line

License

Notifications You must be signed in to change notification settings

adev0x/jsonfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

jsonfmt

Fast JSON formatter and validator for the command line. Written in Go for speed — handles large files without breaking a sweat.

Install

go install github.com/himalaya0x/jsonfmt@latest

Or build from source:

git clone https://github.com/himalaya0x/jsonfmt.git
cd jsonfmt
go build -o jsonfmt .

Usage

# 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

Features

  • 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

License

MIT

About

Fast JSON formatter and validator for the command line

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages