Paste JSON or an escaped JSON string — auto-repair fixes quotes, trailing commas & comments, Unescape turns "{\"a\":1}" back into JSON, and a collapsible tree with JSONPath queries helps you explore any structure. Everything runs in your browser — nothing is uploaded.
Everything about JSON formatting, escaping and debugging — with copy-paste examples.
JSON (RFC 8259) is strict. These are the rules people break most often:
{name: 1} and {'name': 1} are invalid — write {"name": 1}.[1, 2, 3,] fails. Arrays and objects end without a comma.\" \\ \/ \b \f \n \r \t \uXXXX. A raw newline inside a string is invalid — use \n.true / false / null. Python's True/None, JS undefined, NaN and Infinity are not JSON.// and /* */ are not allowed (JSON5/JSONC add them back).01), no hex (0x1F), exponents allowed (1.5e10).true, false, null.Enable Auto-repair and JSON Lens fixes the common violations for you, showing exactly what it changed.
| Error message | Typical cause | Fix |
|---|---|---|
Expected property name or '}' | Unquoted key, or single-quoted key | Quote the key with double quotes — or let Auto-repair do it |
Unexpected token ' in JSON | Single-quoted string | Convert '…' to "…" (Auto-repair handles it) |
Unexpected token } … at position N | Trailing comma before } or ] | Remove the comma; the caret in the error banner shows the spot |
Unexpected end of JSON input | Truncated / half-pasted JSON | Check that all brackets are closed — copy the input again in full |
Unexpected token \n … at line N | Raw newline or tab inside a string | Escape it as \n / \t |
Unexpected token N in JSON | NaN, Infinity or undefined in the data | Replace with null (Auto-repair replaces them) |
| Looks fine but still fails | Smart quotes “ ” ‘ ’ from Word/macOS, BOM, or invisible zero-width characters | Auto-repair normalizes them; paste as plain text |
| Multiple objects, one per line | That's JSON Lines (NDJSON), not a single JSON value | Auto-repair wraps them into an array |
JSON Lens shows the error's line and column, prints the offending line with a caret, and offers one-click repair.
An "escaped JSON string" is JSON wrapped as a string value — what you get from JSON.stringify(obj) inside another JSON, from logs, or from message queues:
"{\"name\":\"Alice\",\"tags\":[\"a\",\"b\"],\"ok\":true}"
Each inner quote is prefixed with \. To get real JSON back you must parse the string once. Common sources of escaped JSON:
%7B%22a%22…) or Base64-encoded (eyJuYW1lIjo…) JSON in query strings and JWT-like tokens.JSON Lens detects each layer automatically — quotes, \n/\" escapes, URL-encoding, Base64 — and unwraps multiple layers in one click. The Escape button does the reverse: it turns your JSON into a safely escaped string you can paste into code or another JSON document.
| Sequence | Meaning |
|---|---|
\" | Double quote |
\\ | Backslash |
\/ | Forward slash (optional escape) |
\n \r \t | Line feed, carriage return, tab |
\b \f | Backspace, form feed |
\uXXXX | Unicode code point (4 hex digits), e.g. \u4e2d = 中 |
Type a JSONPath above the tree and press Run. Supported syntax:
| Expression | Meaning |
|---|---|
$ | Root object |
.key or ['key'] | Object member |
[0], [-1] | Array index (negative counts from the end) |
[0,2] | Multiple indexes |
[1:4], [::2] | Array slice with optional step |
.*, [*] | All members / items |
..key | Recursive descent — every key at any depth |
[?(@.price<10)] | Filter: == != < <= > >=, e.g. [?(@.type=='a')], [?(@.active)] |
$.store.book[*].author // all authors $..price // every "price" anywhere $.items[?(@.qty >= 2 & @.id != 9)]
Results are listed under the tree — click one to jump to the node, or copy them all as a JSON array.
JSON.stringify drops undefined (object properties and array items), functions and symbols; it turns NaN/Infinity into null.Date objects become ISO strings — parsing them back gives strings, not Dates.BigInt throws. Work around it with a replacer (BigInt.prototype.toJSON or string conversion).Converting circular structure to JSON — use a replacer that tracks seen objects.JSON.parse loses number precision for very long numbers (9007199254740993 becomes …992) — handle IDs as strings server-side.-0, sparse arrays, and toJSON() side effects all surprise people; when debugging, prefer the tree view which shows exactly what was parsed.Your data never leaves the browser. There is no backend: parsing, repair, unescaping, JSONPath queries and TS/Schema export all run as local JavaScript. The page has no external scripts, no cookies and no tracking of your input — you can safely paste API responses containing tokens (just remember the share link encodes data in the URL itself, so only share it intentionally).
Under the hood: input is parsed with the native JSON.parse for exact, spec-compliant validation. If it fails, a layered pipeline tries string-unescape (quotes → \n/\" → URL → Base64), then targeted repairs (quotes, commas, comments, literals), reporting every fix. The tree renders nodes lazily, so even large documents stay responsive — and above 2 MB live parsing switches to a manual Parse button.
Quick answers about this JSON formatter and viewer.
No. All parsing, formatting, repair and querying happens locally in your browser with JavaScript. Your input never leaves your device — there is no backend at all.
Paste the escaped string and JSON Lens auto-detects it. You can also press the Unescape button. It strips wrapping quotes, resolves \n, \" and \\ sequences, and handles multi-layer escaping, URL-encoded and Base64-encoded JSON.
Single quotes, trailing commas, unquoted keys, // and /* */ comments, Python literals (True/False/None), NaN/Infinity, smart quotes copied from rich text, and JSON Lines (one object per line, wrapped into an array).
Use the JSONPath bar above the tree. Examples: $.store.book[0].title, $..author, $.items[?(@.price<10)]. Matching nodes are highlighted and results can be copied as JSON.
There is no hard limit. Inputs up to a few MB parse instantly; above 2 MB live parsing switches to a manual Parse button to keep the page responsive, and the tree lazily renders nodes only when you expand them.