JSON Formatter and Validator

About the JSON Formatter and Validator

The JSON Viewer formats, validates, and explores JSON payloads of any size — entirely in your browser, with no upload to any server. The parser follows RFC 8259 (the IETF JSON spec) strictly, so output you copy back into production is guaranteed to round-trip through every conformant JSON library on the planet. Switch between text, tree, and table views to debug an API response, drill into a deeply nested config file, or spot the one mistyped field in a 5 MB payload. The same buffer powers JSON Schema validation (draft 2020-12 and earlier), JMESPath query expressions, and one-click repair for the trailing-comma-and-comments dialects that real-world systems emit. Nothing you paste leaves the tab.

Updated: May 7, 2026

How to use the JSON viewer

  • Paste your JSON into the editor, drag-and-drop a .json file, or click Upload to load a file up to 20 MB.
  • Switch view modes via the editor menu bar: Tree (collapsible nodes for nested exploration), Text (syntax-highlighted source with inline error markers), or Table (tabular projection for arrays of objects).
  • Click Format to pretty-print with two-space indentation, or Minify to strip all whitespace for production payloads.
  • Click Repair to recover invalid JSON. The repairer follows the algorithm in jsonrepair: trailing commas removed, single quotes converted to double, // and /* */ comments stripped, JavaScript literals (NaN, Infinity, undefined) coerced to nulls or strings.
  • Open the Advanced panel for JSON Schema validation (paste a schema, hit Validate, see structured error paths) or JMESPath queries (extract, filter, project) — both run live with no extra round-trip.
  • Use Share to encode the current document in the URL via lz-string compression. Recipients see the exact same buffer.

Common use cases

  • Inspecting a REST or GraphQL API response. The Tree view collapses nested arrays and objects, so you can navigate a 20-level deep response without losing your place. Click any node to copy its path (data.users[3].profile.email) for use in tests or selectors.
  • Debugging a config file. Paste tsconfig.json, package.json, .eslintrc.json, or a Cloudflare Pages _routes.json — the inline error marker pinpoints the exact line and column the parser failed at, with the JSON Pointer (/scripts/build) for tools that need it.
  • Validating webhook or event payloads. Paste a Stripe, GitHub, or Slack webhook body next to its documented JSON Schema, and the Schema panel reports every missing or mistyped field with the schema keyword that failed (required, type, pattern, enum).
  • Bulk exploring a large dataset. Switch to Table mode for arrays of objects: columns auto-derive from the union of keys, rows render lazily, and basic sorting and filtering let you spot the outlier row without reaching for jq.
  • JMESPath transformations. Use expressions like users[?active].email, items[*].{id: id, total: price * quantity}, or [?date >= `2026-01-01`] to extract or reshape a payload before pasting it back into a fixture.

Privacy and security

All parsing, formatting, validation, schema-checking, and JMESPath evaluation happens in your browser. Your JSON — whether it contains an API key, a customer record, or a webhook secret — never leaves your device. There is no server upload, no analytics on the document content, and the URL is only updated if you click the Share button (and even then only with lz-string-compressed content that you control). Disconnect from the network and the tool keeps working: once the page has loaded, every subsequent operation is local.

Tips and pitfalls

  • The repair tool is conservative: it fixes trailing commas, comments, single quotes, and unquoted keys. It will not invent missing fields, guess data types, or reformat a fundamentally broken payload — if your structure is corrupted (mismatched braces, truncated stream), Repair surfaces the location of the unrecoverable break instead of producing silent damage.
  • Browsers struggle past 5 MB in Tree view. The renderer does well on 20 MB in Text mode, but Tree expansion of millions of nodes will stutter — switch back to Text or use the Path Bar to navigate without expanding everything.
  • JSON does not natively support comments or trailing commas, even though many real-world configs use them (tsconfig.json, JSON5, JSONC). The strict parser flags these as errors, which is why Repair exists as a separate one-click step.
  • Unicode escapes are tricky. Per RFC 8259 § 7, valid escapes are \u followed by four hex digits, with surrogate pairs for characters above U+FFFF. Bare emoji and CJK characters work in modern browsers, but copying through tools like Excel or Notepad can mangle them — the viewer renders them faithfully, so what you see is what you have.
  • JSON Schema $ref resolution is local-only by default. The schema panel does not fetch external $ref URIs over the network — paste the entire bundled schema into the schema input if your validator needs cross-file references.
  • Numbers exceeding Number.MAX_SAFE_INTEGER (2^53 - 1) lose precision when parsed by JSON.parse. The viewer flags suspiciously long numeric literals so you can convert them to strings before they round-trip through your stack.

Frequently Asked Questions

Is my JSON data sent to any server?
No. Every byte stays in your browser. Parsing, formatting, validation, schema checks, and JMESPath queries run on the page itself; the network panel will show zero outbound requests once the tool has loaded. You can verify by going offline before pasting.
What is the maximum file size?
The upload picker accepts files up to 20 MB. Performance on very large files depends on your browser and device memory; Text mode renders everything reliably, while Tree mode is comfortable to about 5 MB before expansion latency becomes noticeable.
Can I use the viewer offline?
Yes. After the initial page load the JSON Viewer is fully functional with the network disconnected. The same applies to PWA-installed instances, which share the cached bundle.
Does it support JSON with comments or trailing commas (JSONC, JSON5)?
The strict parser follows RFC 8259, which forbids comments and trailing commas, so they show up as errors. Click the Repair button to convert JSONC/JSON5-style input into spec-compliant JSON in one step. The repairer handles // single-line and /* */ block comments, trailing commas in arrays and objects, single-quoted strings, and unquoted keys.
Is it safe to paste sensitive data like API keys or PII?
Pasted content is processed entirely client-side and is not transmitted anywhere. The URL is not updated automatically — only if you click Share, and that link encodes the document with lz-string compression for transport. If you need an extra guarantee, disconnect from the network before pasting.
What encodings are supported?
UTF-8 only, per RFC 8259 § 8.1. The IETF spec mandates UTF-8 for JSON exchanged between systems; UTF-16 and UTF-32 inputs are auto-converted on upload, but pasted text is treated as UTF-8 by the browser. Unicode escapes (\u00xx, \uD83D\uDE00) are decoded transparently.
What is "Tree mode" good for that Text mode is not?
Tree mode lets you collapse and expand nodes individually, copy a JSON Pointer (/data/users/0/email) for any element, and visually scan deeply nested structures without scrolling through thousands of lines. Text mode is faster for very large payloads and better for editing; Tree is better for inspection.
Can I validate JSON against a schema?
Yes. Click Advanced → Schema. Paste or upload a JSON Schema (draft-04 through 2020-12 supported via Ajv) and click Validate. Errors render with the JSON Pointer to the offending value, the schema keyword (required, type, pattern, enum, etc.), and the human-readable failure message.
Can I query or transform JSON inline?
Yes. Open Advanced → JMESPath. JMESPath is a standardized query language (jmespath.org) for JSON; expressions evaluate live as you type. Common patterns: users[?active].email to filter and pluck, items[*].{id: id, label: name} to reshape, sort_by(events, &timestamp)[-5:] to grab the last five events.
Does it preserve key ordering?
Yes — within the limits of JavaScript object semantics. The parser preserves insertion order for string keys, which matches the de facto behavior of every modern JSON consumer. Re-formatting and minifying preserve the order you input.
How do I recover invalid JSON quickly?
Click Repair. The underlying algorithm (jsonrepair) handles the most common real-world breaks: trailing commas, // and /* */ comments, single quotes, unquoted keys, JavaScript literals like NaN and undefined, and accidentally truncated payloads. If the structure is too damaged to recover, Repair reports the location of the unrecoverable break instead of producing a guess.