JSONZen in your terminal.
Every JSON tool from jsonzen.dev, runnable as a Unix filter. Format, validate, diff, query, decode JWTs, and convert between JSON / YAML / CSV / TypeScript / Zod / Pydantic / JSON Schema — all from your shell.
$ npm i -g jsonzenor npx jsonzen format file.json — no install required.
Quickstart 60 seconds.
Copy each step into your terminal. You'll be piping JSON through it before the kettle boils.
- 1
Install
One global install gives you the `jsonzen` binary on your $PATH.
$ npm i -g jsonzen - 2
Try it
Pretty-print a JSON blob with sorted keys.
$ echo '{"b":1,"a":2}' | jsonzen format --sort - 3
Pipe a real API
Pluck a single field out of a real response.
$ curl -s https://<YOUR_API>/users | jsonzen jq '$.data[*].email'
Install three ways.
Requires Node 20+. Same package on every platform.
npm (global)
Installs the binary to your $PATH. Run from anywhere.
$ npm i -g jsonzennpx (no install)
Run on demand. Slower per-invocation, but no global pollution.
$ npx jsonzen format file.jsonpnpm / yarn
Same package, your favorite manager.
$ pnpm add -g jsonzenEvery command, one binary.
Each command takes a file path or `-` for stdin, writes to stdout, and respects standard exit codes.
jsonzen format
Pretty-print JSON. Sort keys on demand.
$ cat api.json | jsonzen format --sortjsonzen minify
Strip whitespace. Reports bytes saved on stderr.
$ jsonzen minify big.json -o big.min.jsonjsonzen validate
Check JSON against a JSON Schema (Ajv). Exits 3 on failure.
$ jsonzen validate user.json user.schema.jsonjsonzen diff
Semantic diff between two JSON files. Exits 3 on differences.
$ jsonzen diff before.json after.jsonjsonzen jq
Run a JSONPath expression.
$ jsonzen jq '$.users[*].email' data.jsonjsonzen jp
Run a JMESPath expression.
$ jsonzen jp 'users[*].email' data.jsonjsonzen jwt decode
Decode a JWT — header + payload + expiry — without verifying.
$ jsonzen jwt decode "$JWT"jsonzen yaml
Convert between JSON and YAML. Round-trip safe.
$ jsonzen yaml --to data.json -o data.yamljsonzen csv
Convert between JSON arrays and CSV. Configurable delimiter.
$ jsonzen csv --to users.json -o users.csvjsonzen ts
Generate TypeScript declarations from sample JSON (quicktype).
$ jsonzen ts api.json -n ApiResponsejsonzen zod
Generate a Zod runtime validator.
$ jsonzen zod sample.json -n UserSchemajsonzen pydantic
Generate Pydantic v2 BaseModel classes.
$ jsonzen pydantic sample.json -o models.pyjsonzen schema
Infer a JSON Schema (Draft 2020-12 or 07) from sample JSON.
$ jsonzen schema api.json --draft 2020-12
Recipes that actually pay off.
Real-world pipelines you can copy into your shell, your CI, or a pre-commit hook today.
Explore an unknown API
Hit a JSON endpoint, pluck the field you care about, then pretty-print the result. Pipes compose like any Unix tool.
curl -s https://<YOUR_API>/repos/<OWNER>/<REPO> \ | jsonzen jp 'stargazers_count' \ | jsonzen formatValidate a config file in CI
Exit code 3 means the data failed schema validation. Wire it into any CI step — GitHub Actions, GitLab, CircleCI — without extra plumbing.
# .github/workflows/validate.yml - run: npx jsonzen validate ./config.json ./schemas/config.json --mode all-errorsGenerate types from a real API response
Capture a sample response, then turn it into a TypeScript declaration you can drop into your editor. Powered by quicktype.
curl -s https://<YOUR_API>/me > me.sample.json jsonzen ts me.sample.json -n MeResponse -o me.types.tsBlock configuration drift in pre-commit
Compare the working tree against a committed canonical file. Exits 3 if anything changed, which Husky / lefthook / pre-commit will surface as a failed hook.
jsonzen diff config.canonical.json config.json # (exits 0 if identical, 3 otherwise)
Pro
More from JSONZen, in your terminal.
Pro adds end-to-end encrypted snippet sync, private share links, and a larger payload cap on top of every command shown above.
Frequently asked questions.
Privacy, platform, scripting — the things you might be wondering.
- Does the CLI phone home?
- No. Every command runs entirely on your machine. There is no telemetry, no usage tracking, and no required network connection.
- Does it work offline?
- Yes. After the package is installed, every command works without an internet connection.
- Windows support?
- Yes. The CLI runs on any platform Node 20+ runs on — macOS, Linux, Windows, even WSL.
- Why npm and not Homebrew?
- npm covers every platform Node runs on with one publish step, so you can install jsonzen the same way on any operating system.
- How do I report a bug?
- Email support@bobothedev.com with your CLI version, the command you ran, and the output. We read every message.
- Can I use it in scripts?
- Yes — exit codes are documented (0 success, 1 usage, 2 input, 3 convert/validate/diff failure, 4 runtime), and the --json flag emits machine-readable error envelopes to stderr.