JSON Formatter
Format, validate, minify, and analyze JSON in one place.
View JSON online in a collapsible tree. Paste any JSON and explore it interactively: expand and collapse nested objects and arrays, filter by key or value, and switch to a formatted view or structure statistics. Everything runs 100% client-side in your browser, so your data never leaves your device.
Formatted text and a tree view solve different problems. Text is the right tool when you are editing, diffing, or copying. A tree is the right tool when you are exploring a document you did not write and do not yet understand, which describes most encounters with a third party API.
The advantage comes down to three things. First, collapsing: a tree lets you shut every branch and see the top-level shape in five lines instead of five thousand, then open only the branch you care about. Flat text cannot hide anything. Second, shape recognition: with children collapsed, an array of 300 records reads as one line telling you it holds 300 records, so you immediately know whether you are looking at a list, a wrapper, or a deeply nested config. Third, path discovery: a tree shows you where a value sits in the hierarchy, so you can write the accessor for it without counting braces.
A tree also makes absence visible in a way text does not. Scanning collapsed siblings side by side, a record missing a field or holding null where its neighbours hold objects stands out immediately, and that is usually the bug you were looking for.
Everything in a JSON document is one of six types. Knowing the list is useful when reading a tree, because the type of a node tells you what you can do with it and, just as often, tells you what the API author had to work around.
| Type | Example | Notes |
|---|---|---|
| string | "warehouse-3" | Double quoted, UTF-8 text. The only type that can hold arbitrary characters, via escapes where needed. |
| number | 42, -0.75, 6.02e23 | One numeric type covering everything. There is no separate integer type and no decimal type. |
| boolean | true, false | Lowercase only. Some APIs send 1 and 0 or the strings yes and no instead, which are not booleans. |
| null | null | An explicit empty value. Different from a key that is absent altogether, a distinction many APIs rely on. |
| object | {"id": 7} | Unordered set of string keys to values. Keys should be unique; behaviour on duplicates varies by parser. |
| array | [1, "two", null] | Ordered list. Elements may be of mixed types, though most real schemas keep them uniform. |
Three absences matter more than the six presences. There is no date type, so timestamps travel as ISO 8601 strings such as 2024-11-08T14:03:00Z or as epoch numbers, and it is entirely up to the consumer to know which. There is no integer and float distinction, so an id and a price are the same type to the parser, and JavaScript will hand both back as double precision floats. And there is no comment syntax, which is why so many configs carry an unused key holding a human-readable note.
A JSON path is an address for a value inside a document. Dot notation steps into an object key and bracket notation selects an array index or a key containing characters that dot notation cannot express. It is the same syntax you use to read the value in JavaScript, which is why it is worth reading paths off a tree directly. Take this document.
{
"org": "Northwind",
"data": {
"users": [
{
"id": 11,
"email": "ana@northwind.test",
"roles": ["admin", "audit"],
"address": { "city": "Porto", "postcode": "4000-123" }
},
{
"id": 12,
"email": "kai@northwind.test",
"roles": [],
"address": null
}
],
"counts": { "active": 1, "invited": 1 }
}
}Every path below is evaluated against it. Note how naturally the two notations mix as you alternate between objects and arrays.
| Path | Resolves to |
|---|---|
| org | "Northwind" |
| data.counts.active | 1 |
| data.users | the array of two user objects |
| data.users[0].email | "ana@northwind.test" |
| data.users[0].roles[1] | "audit" |
| data.users[0].address.city | "Porto" |
| data.users[1].roles | [] (present but empty) |
| data.users[1].address.city | an error, since address is null |
| data.users[2] | undefined, the index is out of range |
Two of those rows are the interesting ones. Reading a property of null throws, which is why defensive code uses optional chaining such as data.users[1].address?.city. And an out of range index returns undefined rather than throwing, so a missing record fails silently further downstream. Use bracket notation with a quoted string for awkward keys, as in obj["content-type"], since a hyphen is not valid in dot notation.
Browser-based viewers have real limits, and it helps to know where they are before you paste a 200 MB export into one. The parsed structure typically occupies several times the size of the source text, because every string, number, and object carries per-value overhead in the runtime. A 50 MB file can therefore reach several hundred megabytes of live objects, and rendering a node for every value multiplies that again.
Collapsing helps directly here, not just visually. A viewer that only creates DOM nodes for expanded branches keeps the rendered node count in the hundreds regardless of document size, so scrolling stays smooth. Parsing remains the fixed cost you cannot avoid.
Past a few hundred megabytes, stop loading the whole document. Use a streaming approach instead: a jq pipeline reads the file incrementally and emits only what you asked for, so memory stays flat no matter how large the input is.
# pull one field from every record without loading the file
jq '.data.users[] | {id, email}' export.json > slim.json
# count records to understand the shape first
jq '.data.users | length' export.jsonFor newline-delimited JSON, where each line is its own document, the same idea applies with standard shell tools: take the first few thousand lines, view those, and only reach for the full file once you know what you are looking for.
When you need to edit rather than explore, the JSON Editor and the JSON Formatter are the next stops. Browse the full collection of free JSON tools to find the right one for the job.
Reading raw JSON is hard: a single API response can contain hundreds of nested objects, and scrolling through formatted text tells you little about the overall shape. This JSON viewer online tool turns any JSON document into an interactive tree, so you can collapse everything to see the top-level structure, then expand exactly the branch you need. The filter box finds keys and values buried deep in the hierarchy, the formatted view gives you clean indented text for copying, and the stats view summarizes keys, depth, and value types at a glance. Free, instant, and 100% client-side, it is a safe way to inspect production payloads, debug webhooks, and explore unfamiliar APIs.