JSON Formatter & Viewer
Format, validate, minify and explore JSON entirely in your browser. Precise error locations, an interactive tree with copyable JSON paths, and nothing uploaded to a server.
Drop a JSON file here
.json · up to 10 MB · nothing leaves your device
{{ t.v }}{{ '\n' }}{{ output }}
Original {{ sizeLabel }} Minified {{ fmtBytes(outSize) }} Saved {{ savedPct }}%
- {{ row.node.quoted ? '"' + row.node.label + '"' : row.node.label }} : {{ rowValue(row.node) }} {{ row.node.type === 'array' ? '[ ]' : '{ }' }} {{ rowType(row.node) }}
Only the first {{ fmtNum(rows.length) }} rows are shown. Collapse a branch to explore a different part of the document.
- Path
- {{ sel.path }}
- Type
- {{ sel.type }}
- {{ selValueLabel() }}
- {{ selValue() }}
Select any row to see its JSON path, type and value.
- Size
- {{ sizeLabel }}
- Objects
- {{ fmtNum(stats.objects) }}
- Arrays
- {{ fmtNum(stats.arrays) }}
- Keys
- {{ fmtNum(stats.keys) }}
- Max depth
- {{ fmtNum(stats.depth) }}
- Strings
- {{ fmtNum(stats.strings) }}
- Numbers
- {{ fmtNum(stats.numbers) }}
- Booleans
- {{ fmtNum(stats.booleans) }}
- Nulls
- {{ fmtNum(stats.nulls) }}
- Lines
- {{ fmtNum(outCount) }}
Statistics appear once the document parses.
Invalid JSON
Line {{ err.line }}, Column {{ err.col }} · position {{ err.pos }}
{{ err.msg }}
│ {{ r.caret }}{{ r.no }} │ {{ r.text }}{{ '\n' }}
{{ note }}
Paste JSON above, or load a file, to get started. Invalid JSON {{ sizeLabel }} Valid JSON {{ sizeLabel }} {{ fmtNum(stats.objects) }} objects {{ fmtNum(stats.arrays) }} arrays {{ fmtNum(stats.keys) }} keys depth {{ stats.depth }} {{ sizeLabel }} loaded — press Format to process it. Ln {{ cursor.line }}, Col {{ cursor.col }}
{{ modKey }}↵ Format {{ modKey }}⇧F Format {{ modKey }}M Minify {{ modKey }}K Clear Tab Indent {{ modKey }}Z Undo
All formatting, validation and inspection happens in your browser. Your JSON is never uploaded to a server.
About JSON formatting
JSON is easy for machines to read and painful for people to read once it arrives minified on a single line. Formatting re-indents it so the structure becomes visible; minifying strips every byte that isn't required, which is what you want before sending it over the wire. Neither changes the data — only its whitespace.
Where JSON parsing actually fails
Most "invalid JSON" errors come from writing JavaScript by mistake. Trailing commas,
single-quoted strings, unquoted property names, NaN, Infinity and
undefined are all legal JavaScript and none of them are legal JSON. Python spellings
— True, False, None — fail for the same reason.
Browsers report these badly. Chrome tells you a byte offset, Firefox tells you a line and column,
and Safari often tells you neither. This tool re-scans rejected input itself so you always get an
exact line and column, the offending line in context, and a message that names the mistake rather
than just saying SyntaxError.
JSON paths make large responses navigable
In the tree view, selecting any property gives you its path — something like
$.users[0].profile.email — ready to copy into a test, a jq filter, or a bug report.
That is usually faster than scrolling a 5,000-line API response looking for the field you need.
Sorting keys changes the document
Key order is preserved by default, because reordering keys produces a different document even though it carries the same data. Turn on Sort keys deliberately — it is genuinely useful for diffing two responses that list the same fields in a different order.
Comparing two documents instead of formatting one?
Format both first if either one needs it, then use the JSON Diff tool to see exactly what changed between them — added fields, removed fields, changed values, and type changes, each with its own JSON path.
Working with Base64 instead?
Use the Base64 encoder and decoder, or the URL encoder and decoder for percent-encoding.
Frequently asked questions
Why does my JSON say invalid when it looks fine?
Almost always because it is JavaScript rather than JSON. Trailing commas, single-quoted strings, unquoted property names, NaN, Infinity and undefined are all legal JavaScript and none of them are legal JSON. This tool names which one it found and points at the line and column.
What is the difference between formatting and minifying?
Both keep the data identical and only change whitespace. Formatting adds indentation and line breaks so you can read the structure; minifying removes every optional byte so the document is as small as possible to transmit.
What is a JSON path?
A path such as $.users[0].profile.email addresses one value inside the document. Select any row in the tree view and the tool shows the path along with the value type, ready to copy.
Should I sort the keys?
Only when you mean to. Key order is preserved by default because reordering keys produces a different document, even though it carries the same data. Sorting is genuinely useful for diffing two API responses that list the same fields in a different order.
How large a file can it handle?
The limit is 10 MB. Past roughly 512 KB the tool stops reformatting on every keystroke and waits for you to press Format, so typing stays responsive on large documents.
Is my JSON uploaded anywhere?
No. Parsing, formatting, validation and the tree view all run in your browser using JavaScript. Nothing is transmitted to a server, and JSON often contains API responses, tokens and customer data, so this matters.