npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsonfmt-dev

v1.0.1

Published

JSON formatter, validator, differ & stats — zero dependencies, colorized CLI. jsonfmt.dev

Readme

@jsonfmt/cli

Format, validate, diff, and inspect JSON from your terminal.

Zero dependencies. Colorized output. Runs anywhere Node.js runs.

npm version license node downloads


Install

npm install -g @jsonfmt/cli

Or run instantly without installing:

npx @jsonfmt/cli '{"hello":"world"}'

Quick Start

# Format a file
jsonfmt data.json

# Pipe from stdin
echo '{"name":"Alice","age":30}' | jsonfmt

# Validate
jsonfmt --validate data.json

# Diff two files
jsonfmt --diff a.json b.json

# Get stats
jsonfmt --stats data.json

Output Example

$ echo '{"name":"Alice","age":30,"roles":["admin","user"],"active":true}' | jsonfmt

{
  "name": "Alice",
  "age": 30,
  "roles": [
    "admin",
    "user"
  ],
  "active": true
}
$ jsonfmt --stats data.json

  keys       3
  strings    1
  numbers    1
  booleans   1
  arrays     1
  objects    1
  depth      2
  bytes      65
$ jsonfmt --diff a.json b.json

  ~ age: 28 → 29
  + role: "admin"
  - email: "[email protected]"

All Options

| Flag | Description | Example | |------|-------------|---------| | (no flag) | Pretty-print with colors | jsonfmt data.json | | --minify | Compact single-line output | jsonfmt --minify data.json | | --sort-keys | Sort object keys A-Z | jsonfmt --sort-keys data.json | | --validate | Check validity (exit 0/1) | jsonfmt --validate data.json | | --stats | Count keys, types, depth, bytes | jsonfmt --stats data.json | | --diff <file> | Compare two JSON files | jsonfmt --diff a.json b.json | | --get <path> | Extract value by dot-path | jsonfmt --get "users[0].name" data.json | | --indent <n\|tab> | Set indentation (default: 2) | jsonfmt --indent 4 data.json | | --max-depth <n> | Truncate nested output | jsonfmt --max-depth 3 data.json | | --max-array <n> | Truncate long arrays | jsonfmt --max-array 5 data.json | | --no-color | Disable ANSI colors | jsonfmt --no-color data.json > out.txt | | --help | Show help | jsonfmt --help |


Use Cases

CI/CD pipelines — validate JSON configs before deploy:

jsonfmt --validate config.json || exit 1

API debugging — format curl responses:

curl -s https://api.example.com/users | jsonfmt

Extract values — pull fields from JSON files:

jsonfmt --get "database.host" config.json

Compare configs — diff staging vs production:

jsonfmt --diff staging.json production.json

Minify for storage — shrink JSON payloads:

jsonfmt --minify large.json > small.json

How It Works

Custom Lexer -> Parser -> AST pipeline (same engine as jsonfmt.dev):

Input string
  → Lexer (tokenize: strings, numbers, braces, colons)
  → Parser (build AST: objects, arrays, values)
  → Formatter (colorize + indent)
  → Terminal output
  • Better error messages than JSON.parse — shows exact line and column
  • Handles all JSON edge cases (unicode escapes, nested depth, large files)
  • Zero dependencies — single 25KB file, no node_modules

Ecosystem

| Product | What | Link | |---------|------|------| | Web App | Full JSON toolkit (33 converters, 8 tabs, AI Helper) | jsonfmt.dev | | API | 63 REST endpoints for JSON processing | api.jsonfmt.dev/docs | | CLI | This package | npm i -g @jsonfmt/cli | | Chrome Extension | Auto-format JSON in browser tabs | Chrome Web Store | | Bookmarklet | One-click format on any page | jsonfmt.dev/bookmarklet |


Why Not Just Use jq?

| | jsonfmt | jq | |---|---|---| | Install | npm i -g @jsonfmt/cli | Separate binary, varies by OS | | Syntax | Familiar flags (--get, --diff) | Custom query language to learn | | Colors | Built-in, automatic | Requires --color-output | | Diff | --diff a.json b.json | Not built-in | | Validate | --validate with exit codes | jq . > /dev/null (workaround) | | Stats | --stats (types, depth, bytes) | Not built-in | | Deps | Zero | C binary |

Use jsonfmt for formatting, validating, and inspecting. Use jq for complex data transformations.


License

MIT


jsonfmt.dev — Format, validate, convert, diff, repair, and query JSON.