Nothing uploaded Exact error line Tree view Repair mode

JSON Formatter & Validator

Paste minified API responses, log lines or half-broken config files. Get perfectly indented, syntax-coloured JSON — plus the exact line and column when something is wrong, and a repair button for the usual suspects (trailing commas, single quotes, comments).

JSON workspace Waiting for input
Input Ctrl/⌘ + Enter to format
Size: 0 B Lines: 0
Output —

Formatted JSON will appear here.
Press Ctrl+Enter or click Format.

Keys
—
Max depth
—
Root type
—

What “repair” actually fixes

Strict JSON is unforgiving: one trailing comma and the whole file is invalid. Real-world data rarely arrives that clean — people paste JavaScript object literals from a console, config snippets from a blog post, or a log line with a comment bolted onto the end. The repair button walks your text with a small scanner and safely rewrites:

  • Trailing commas — [1, 2, 3,] becomes [1, 2, 3]
  • Single-quoted strings — 'value' becomes "value", with inner quotes escaped correctly
  • Unquoted keys — {'name'} style keys like { name: 1 } get quotes
  • Comments — // line and /* block */ comments are removed
  • JS-only values — undefined, NaN and Infinity become null

It runs character by character, so a comma or colon inside a string is never touched. If the result still will not parse, the original text is left exactly as you pasted it and the error panel tells you where the problem is.

Reading the error message

When JSON breaks, browsers report a position. This tool converts that into a line and column and prints the offending source line with a caret underneath:

line 4, column 12
  "price": 19.99,
             ^  Expected double-quoted property name

Nine times out of ten the real mistake is a few characters earlier — a missing comma on the previous line, or a quote that was never closed.

Format vs minify vs sort

Format expands the document with your chosen indentation so it is readable in a diff or a code review. Minify strips every unnecessary byte — useful when you are pasting JSON into a URL, an environment variable or a database cell with a size limit. Sort keys reorders object keys alphabetically at every level, which makes two documents comparable and keeps config files predictable in version control.

Why the tree view helps

Deeply nested API responses are hard to read even when they are perfectly indented. The tree view renders collapsible nodes with type-coloured values, so you can collapse the 400-element array you do not care about and inspect the two objects you do. Switch back to Code whenever you want to copy the text.

Safety

Your JSON is parsed with the browser’s own JSON.parse — no evaluation, no server, no analytics on the content. That matters when the payload contains tokens, customer records or internal URLs. Close the tab and it is gone.

Frequently asked questions

Is my JSON uploaded to a server?
No. Parsing, formatting and highlighting all happen in your browser. You can switch off your network after the page loads and the tool keeps working.
How large a file can it handle?
Files are capped at 20 MB. Beyond roughly that the syntax highlighter can feel sluggish; use Minify or the tree view with large payloads.
Does it support JSON5, JSONC or JSONL?
Partially. The Repair button handles the most common JSON5/JSONC extras (comments, single quotes, trailing commas, unquoted keys). Newline-delimited JSON (JSONL) needs to be wrapped into an array first — join the lines with commas inside [ ].
Are numbers and big integers preserved exactly?
JSON.parse converts numbers to IEEE-754 doubles, exactly like every other JavaScript tool. Integers beyond 2⁵³ (such as Twitter/X or Discord snowflake IDs) lose precision — keep those as strings in your source data.
Can I convert formatted JSON back to a single line?
Yes — click Minify. It also removes all indentation whitespace, which is usually 10–25% of the file size.