[JSONZen]

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 jsonzen

or 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. 1

    Install

    One global install gives you the `jsonzen` binary on your $PATH.

    $ npm i -g jsonzen
  2. 2

    Try it

    Pretty-print a JSON blob with sorted keys.

    $ echo '{"b":1,"a":2}' | jsonzen format --sort
  3. 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 jsonzen

npx (no install)

Run on demand. Slower per-invocation, but no global pollution.

$ npx jsonzen format file.json

pnpm / yarn

Same package, your favorite manager.

$ pnpm add -g jsonzen

Every 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 --sort
  • jsonzen minify

    Strip whitespace. Reports bytes saved on stderr.

    $ jsonzen minify big.json -o big.min.json
  • jsonzen validate

    Check JSON against a JSON Schema (Ajv). Exits 3 on failure.

    $ jsonzen validate user.json user.schema.json
  • jsonzen diff

    Semantic diff between two JSON files. Exits 3 on differences.

    $ jsonzen diff before.json after.json
  • jsonzen jq

    Run a JSONPath expression.

    $ jsonzen jq '$.users[*].email' data.json
  • jsonzen jp

    Run a JMESPath expression.

    $ jsonzen jp 'users[*].email' data.json
  • jsonzen 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.yaml
  • jsonzen csv

    Convert between JSON arrays and CSV. Configurable delimiter.

    $ jsonzen csv --to users.json -o users.csv
  • jsonzen ts

    Generate TypeScript declarations from sample JSON (quicktype).

    $ jsonzen ts api.json -n ApiResponse
  • jsonzen zod

    Generate a Zod runtime validator.

    $ jsonzen zod sample.json -n UserSchema
  • jsonzen pydantic

    Generate Pydantic v2 BaseModel classes.

    $ jsonzen pydantic sample.json -o models.py
  • jsonzen 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 format
  • Validate 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-errors
  • Generate 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.ts
  • Block 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.
Read the full README on npm →Report a bug · support@bobothedev.com
    JSONZen CLI — JSON tools in your terminal | JSONZen