Open-source CLI
Format and check JSON without losing the data.
Best JSON Formatter is a fast, MIT-licensed command-line tool for developers, CI, Codex, and Claude Code. It preserves duplicate properties, large integers, number notation, escape spelling, and key order.
Check a file in one command
npx -y bestjsonformatter@latest check response.jsonInstall globally for the shorter command, or add it to a project for a pinned CI dependency:
npm install --global bestjsonformatter
bjf check response.json --json
bjf format response.json --writeExit code 0 is clean, 1 means invalid JSON or correctness findings, and 2 identifies a command or runtime failure.
Small commands with explicit effects
check- Validate syntax and find duplicate keys, unsafe numbers, and notation risks in one pass.
format --check- Verify canonical whitespace without changing the file.
format --write- Format through a same-directory temporary file and atomic rename.
repair- Preview a repair for comments, trailing commas, single quotes, and unquoted keys.
compare- Compare structure while ignoring whitespace and object-key order.
query- Run JSONPath directly against a local document.
Ordinary formatting changes whitespace only. Sorting, repair, conversion, and file writes remain explicit so neither a person nor an agent can silently broaden the operation.
Fast because the hot path stays small
A reproducible five-run fresh-process benchmark formatted 1.07 MB in a 143 ms median and 5.35 MB in 473 ms on the recorded Intel Mac. It was the fastest formatter in that comparison that preserved every tested token. Native Node and jq remain useful lossy speed floors.
The repository records competitor versions, exactness fixtures, every raw sample, medians, p95, timeouts, and the full command boundary in the benchmark ledger.
Use it from coding agents without MCP
Codex, Claude Code, Cursor, GitHub Copilot, and other coding agents can call local CLI commands through their normal shell. Files do not need to be copied into a model tool argument.
npx skills add skrcode/bestjsonformatter-cliThe public skill teaches agents to check first, return compact JSON diagnostics, and request authorization before using --write.
Human review
Use the browser when the document needs eyes.
The CLI is ideal for files, scripts, CI, and agents. Use the web workspace for a searchable, editable, foldable view. Both use the same lossless correctness model and process documents locally.