JSON Formatter & Validator Pro
Format, validate, query, diff, and transform JSON — fully in your browser
Input JSON
Formatted Output
JSON Formatter, Validator, JSONPath, Diff & Schema — onDevTools
Format, validate, query, diff, and transform JSON entirely in your browser. RFC 8259 strict parser plus JSONC mode, JSON Schema Draft 2020-12 validation, RFC 9535 JSONPath, deep diff with JSON Merge Patch, and flatten / unflatten / remove-nulls transforms — no upload, no tracking.
Features
- Pretty-print and minify JSON with configurable indent (2, 4, 8 spaces) and optional alphabetical key sort
- Strict RFC 8259 / ECMA-404 parser plus a JSONC lenient mode that accepts // and /* */ comments and trailing commas
- Interactive collapsible tree view with full-text search, expand/collapse-all, and per-node copy of value or JSON Pointer path
- JSON Schema validator (Draft 2020-12) reporting type, required, enum, pattern, min/max, oneOf/anyOf/allOf, additionalProperties, and array-item violations with full instance paths
- JSONPath query engine (RFC 9535) supporting wildcards, recursive descent (..), array slicing, and filter expressions like $[?(@.price > 10)]
- Side-by-side deep diff with color-coded added / removed / modified / unchanged segments, plus copy or download of the diff output
- Transform pipeline: flatten to dot-notation, unflatten back, remove nulls, remove empty strings/arrays/objects, and chain operations
- JSON statistics dashboard: total items, object/array counts, type breakdown, and maximum nesting depth
- Inline error reporting with line and column from the parser plus suggestions to enable JSONC mode when the failure looks like a comment or trailing-comma issue
- One-click copy or download for formatted, minified, schema, or diff output
- Runs entirely client-side — JSON, schemas, and diff inputs never leave your browser
How to use
- Paste or drop your JSON into the Input JSON panel — auto-format triggers as you type, or click Format for an explicit pass.
- If parsing fails on a config file or VS Code settings, toggle the JSONC switch to allow comments and trailing commas, then re-run.
- Switch to the Tree view to explore deeply nested structures; use the search box to highlight matching keys or values, and copy any node's path or value.
- Open the Schema Validation tab, paste a JSON Schema document, and click Validate — every violation shows the failing keyword and the JSON Pointer path of the offending value.
- Use the Diff Comparison tab to compare two JSON documents and copy the patch as a JSON Merge Patch ready to apply elsewhere.
- Use the JSONPath Query tab to extract or filter parts of the document with expressions like $.store.book[?(@.price < 10)].title.
- Use the Transforms tab to flatten, unflatten, or strip nulls; chain transforms by re-running them on the updated input, then copy or download the result.
Tips & Best Practices
- Toggle JSONC the moment you see 'Unexpected token /' or 'Unexpected token ,' — it's almost always a config file with comments or a trailing comma.
- Use Sort keys before committing JSON config files to keep PR diffs minimal.
- Copy the JSON Pointer path from the Tree view to drop a deep link to a specific node into your bug report or PR description.
- If a 64-bit ID renders as 1234567890123456800, your producer is emitting it as a number — switch the API to send IDs as strings.
- Chain Remove Nulls → Minify → Copy to produce the smallest possible payload for HTTP request bodies.
FAQ
Do you store my JSON?
No. Parsing, validation, schema checks, diffing, and transforms all run in your browser using local JavaScript and the Web Crypto / DOM APIs — nothing is uploaded. This makes it safe to paste API responses, configuration files, or sensitive payloads from production systems.
Which JSON specification does the parser follow?
Strict mode follows RFC 8259 / ECMA-404, the IETF and ECMA standards for JSON. JSONC mode (toggle the JSONC switch) layers on the comment and trailing-comma extensions used by VS Code's settings.json, tsconfig.json, and similar config files. JSON5 (e.g. unquoted keys, single quotes, hex numbers) is not currently supported — use a JSON5 parser if your input requires those forms.
What does the JSON Schema validator support?
Validation runs against JSON Schema Draft 2020-12 with full coverage of type, required, enum, pattern, format, minimum/maximum, minLength/maxLength, minItems/maxItems, additionalProperties, items, prefixItems, oneOf/anyOf/allOf, $ref, and conditional if/then/else. Each violation reports the failing keyword plus the JSON Pointer path to the bad value, so you can pinpoint deeply nested issues without scanning the whole instance.
Which JSONPath expressions are supported?
The query engine implements the RFC 9535 surface: root ($), child segment ($.key, $['key']), array index and slice ([0], [0:3]), wildcards ([*]), recursive descent (..), and filter expressions with comparison, regex, and logical operators (e.g. $[?(@.price > 10 && @.in_stock == true)]). Multiple results are returned as an array; values are extracted in document order.
What is the difference between JSONC and JSON5?
JSONC is plain JSON plus // line comments, /* */ block comments, and trailing commas — popular for human-edited config files. JSON5 is a superset that additionally allows unquoted keys, single-quoted strings, hex/leading-decimal numbers, and NaN/Infinity. This tool supports JSONC; for JSON5 input you'll need to convert it first or use a JSON5 parser.
Can I format very large JSON files?
Yes, but the tree view and JSONPath engine scale roughly linearly with node count, so above ~1 MB / ~50,000 nodes the UI becomes noticeably slower. For large payloads, use Plain view instead of Tree, run the Minify transform first if you only need compact output, or split the document by top-level key. Streaming and JSON Lines (.jsonl) are out of scope — use a CLI like jq for those.
How does this compare to jq, jsonlint, or VS Code's built-in formatter?
jq is unbeatable for scripted pipelines and streaming, and jsonlint covers strict validation. This tool's advantage is doing everything in one place — format + validate + schema-check + JSONPath + deep diff + transforms — without leaving the browser. VS Code's built-in formatter handles pretty-printing but not schema-aware error paths, JSONPath, or diff/merge.
Why does the parser say 'Unexpected token' on a config file?
The parser is strict by default, so // comments, /* */ blocks, and trailing commas all produce an error pointing at the offending character. The status panel will suggest enabling JSONC mode automatically when the failure pattern matches one of those features. If the message points at a fully-quoted string, double-check for unescaped backslashes or control characters — those are the other common culprits.
Can I customize the indentation and key order?
Yes. Choose 2, 4, or 8 spaces in the Indent control, and toggle Sort keys to emit object keys in alphabetical order — useful for stable diffs and reproducible config files. Output is always UTF-8 with newline-separated lines (no BOM); the formatter never reorders array elements because that would change semantics.
What transform operations are available?
Flatten converts {a:{b:1}} to {"a.b":1} for tools that expect dot-notation keys (env vars, feature flags). Unflatten reverses it. Remove Nulls strips all null-valued properties recursively, Remove Empty also drops empty strings, [] and {}, and Minify produces a single-line output. Transforms apply to the current input, so you can chain them to compose pipelines.
Does the tool support extracting JSON Pointer paths?
Yes. In the Tree view, hovering any node reveals its JSON Pointer (RFC 6901) path — e.g. /store/book/0/author — which you can copy with one click. JSON Pointer is the same notation that schema and diff results use to identify locations, so you can paste a path from one panel into another to navigate to the same value.
Can I share a formatted result with a teammate?
The fastest way is to paste the JSON on their machine — there's no server-side state to share a link to. If you need a permalink-style hand-off, use a Gist or paste service with the minified output. Avoid sharing tokens, secrets, or PII in any case, even client-side, because the receiving teammate's clipboard or console may persist them.
Does it handle Unicode and large numbers correctly?
All input is treated as UTF-8 and surrogate pairs (emoji, CJK characters) round-trip without escaping. Numbers above Number.MAX_SAFE_INTEGER (2^53 − 1) lose precision because the underlying parser uses IEEE-754 doubles — that's a JSON spec quirk, not a tool limitation. If you're carrying 64-bit IDs, send them as strings, which is what most APIs do.