WB JSON Formatter

Format, validate, and explore JSON with exact error locations, tree view, and minify. Handles multi-MB files 100% in your browser.

🔒 100% private - API payloads and secrets are processed on your device only
Input
Output

Errors you can find

Not "Unexpected token at position 4193" - you get the line, the column, a caret pointing at the exact spot, and a plain-language cause like "trailing comma before }".

Private by design

Developers paste API responses, tokens, and customer data into JSON tools every day. Here nothing is uploaded - ever. No requests, no analytics, no storage.

Free, forever

No pro tier, no size limit games, no ads between you and your data. Multi-MB files are fine, and it works offline.

How to fix the most common JSON errors

Nearly every "invalid JSON" failure is one of these seven mistakes. The validator above names them for you and points at the exact spot:

JSON is defined by RFC 8259. All of these are legal in JavaScript - and illegal in JSON, which is why hand-edited files break.
MistakeExampleFix
Trailing comma[1, 2, 3,]Remove the comma after the last item
Single quotes{'name': 'Ada'}Use double quotes: {"name": "Ada"}
Unquoted key{name: "Ada"}Quote every key: {"name": …}
Comments// configDelete them - JSON has no comments
NaN / Infinity / undefined{"x": NaN}Use null or a number
Real line break in a string"line one⏎two"Escape it as \n
Missing comma or colon{"a": 1 "b": 2}Separate pairs with commas, keys with colons

JSON syntax in 60 seconds

JSON has exactly six value types: object { }, array [ ], string (double-quoted only), number (no leading zeros, no NaN), and the keywords true, false, null. Object keys are always double-quoted strings. Whitespace between tokens is free; comments and trailing commas are not allowed. That's the whole language:

{
  "name": "Ada Lovelace",
  "born": 1815,
  "fields": ["mathematics", "computing"],
  "active": false,
  "notes": null,
  "address": { "city": "London" }
}

JSON vs JSONC vs JSON5

Editors and config systems often accept relaxed supersets: JSONC (JSON with comments - VS Code settings) and JSON5 (comments, trailing commas, unquoted keys, single quotes). They are fine as input to tools that explicitly support them - but anything sent to an API, stored as .json, or parsed by a standard library must be strict JSON. When in doubt, validate here first.

Frequently asked questions

Is it safe to paste API responses or data with secrets here?

Yes - and that is the point of this tool. Everything runs in JavaScript in your browser: nothing you paste is uploaded, logged, or stored, and the page makes no network requests after loading. Most online JSON tools send your payload to their server; with tokens, keys, and customer data in developer clipboards all day, local-only processing is the only responsible design.

How do I fix "Unexpected token" JSON errors?

Paste the JSON here and validate - instead of a cryptic token message you get the exact line and column plus a plain-language cause. The usual suspects: a trailing comma after the last item, single quotes instead of double quotes, an unquoted key, comments (JSON does not allow them), or a missing comma between items.

Does JSON allow comments or trailing commas?

No. Standard JSON (RFC 8259) allows neither comments nor trailing commas - both are the most common reasons hand-edited JSON fails to parse. Some tools accept relaxed supersets like JSONC (VS Code configs) or JSON5, but anything you send to an API or parse with a standard library must be strict JSON.

How large a JSON file can this handle?

Multi-megabyte files are fine - parsing and formatting use the browser's native engine, which handles tens of MB in well under a second on a modern machine. For very large files the tree view renders containers in chunks of 500 children so the page stays responsive. The practical ceiling is your device's memory.

What is the difference between formatting and minifying?

Formatting (pretty-printing) adds line breaks and indentation so humans can read the structure; minifying removes every unnecessary character so machines can transmit it - typically 20-40% smaller than formatted JSON. The data is identical either way. Format while developing and debugging; minify for payloads, configs in tight places, and storage.

How do I convert JSON to an escaped string and back?

Use the Escape button to turn the input into a double-quoted string literal with every quote, backslash, and newline escaped - ready to embed inside another JSON document or a source file. Unescape does the reverse: paste a quoted string literal and get the original text back.

Why did my keys change order?

Only if "Sort keys" is enabled - it rewrites every object with keys in alphabetical order, which makes large payloads diff-able and easy to scan. With it off, key order is preserved exactly as pasted. Note that JSON itself guarantees no key order, so no correct consumer should depend on it either way.

Does the JSON formatter work offline?

Yes. The entire tool is one self-contained page - once loaded, formatting, validation, and the tree view all work with no connection. Save the page locally and it works forever, which also makes it safe for air-gapped environments.