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-04 through 2020-12), JMESPath query expressions, and one-click repair for the trailing-comma-and-comments dialects that real-world systems emit. Nothing you paste is sent to our servers, and the document is not written to the page address as you edit; it goes into a link only when you click Share.

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.
  • The document is not saved in the page URL as you edit. Click Share to copy a link that opens the same document (long documents are lz-string compressed in the link, which is not encryption). A document that stays over 200,000 characters after compression is too large for a link, and Share says so instead of copying a link that would open empty. Open in JSON Viewer in the HTTP Request Tester hands the response over through browser session storage, so the body never appears in the URL.

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. There is no server upload and no analytics on the document content. The document is not written to the page address while you edit, so it is not sent to the CDN on reload and does not stay in your browser history. It goes into a link only when you click Share; long documents are lz-string compressed, which is not encryption, so anyone with the link can read it. When you open a shared link, the page loads the document and then removes it from the address bar. A response opened from the HTTP Request Tester is handed over through this tab's session storage and deleted as soon as the viewer has loaded it. Scripts on the page, including ads, run alongside the editor, so redact API keys, customer records, and webhook secrets you do not need. Once the page has loaded, every operation is local; JSON Schema checks and JMESPath queries load their code the first time you use them, and after that the tool keeps working with the network disconnected. A shared link stays in the recipient's browser history and in any app the link passes through.

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. Parsing, formatting, validation, schema checks, and JMESPath queries run on the page itself, and the tool sends no request containing your document. The document is not written to the page address, so a reload does not send it to the CDN; it goes into a link only when you click Share.
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?
Mostly. Once the page and its editor have loaded, formatting, validation, and editing work with the network disconnected. JMESPath queries load their code the first time you use them, and JSON Schema checks load one validator for every draft the first time you use them, so run a query and a schema check once before going offline. There is no offline cache, so keep the tab open: a reload without a network connection does not load the page.
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?
With care. Pasted content is processed client-side and is not sent to our servers or analytics, and the viewer does not write the document to the page address as you type, so it does not end up in your browser history. It goes into a link only when you click Share, and anyone with that link can read it (lz-string compression is not encryption). Scripts on the page, including ads, run alongside the editor, so redact secrets and personal data you do not need.
What encodings are supported?
UTF-8 only, per RFC 8259 § 8.1. The IETF spec mandates UTF-8 for JSON exchanged between systems; uploaded files are read as UTF-8 unless they start with a UTF-16 byte-order mark, which the browser honors; pasted text is already decoded 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 a JSON Schema (draft-04, draft-06, draft-07, 2019-09, and 2020-12 supported via @cfworker/json-schema, picked from the $schema keyword, or draft-07 when it is absent; draft-06 schemas are checked with draft-07 rules) and click Validate. Any other non-empty $schema value is reported as unsupported; an empty one uses draft-07. 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.