Skip to content

JSON Viewer

Runs 100% in your browser — nothing is uploaded, nothing is stored.

Click any branch to expand or collapse it. Nothing is uploaded.

A few hundred lines of raw JSON tells you almost nothing at a glance. The structure is there, but you have to reconstruct it in your head as you read. A tree view hands that work back to the browser: nesting becomes indentation, types become colours, and any branch you do not care about collapses to a single line.

This viewer builds a real element tree rather than injecting markup, which matters for a security reason as well as a layout one. A string value containing HTML tags is displayed as literal text, so a payload you did not write cannot execute anything by being pasted in.

How to use this tool

  1. Paste your JSON into the box and click View. Invalid documents produce an error message rather than an empty tree.
  2. Click any branch to expand or collapse it. The Depth selector sets how many levels start open, which is the difference between a readable overview and ten thousand rendered nodes.
  3. Read the type from the colour: blue keys, green strings, amber numbers, purple booleans, grey nulls. A value that arrived as a string when you expected a number is visible instantly rather than after a careful read.
  4. Use Copy path list to flatten the document into one dotted path per leaf, such as user.address.city — the exact form you would write in JavaScript to reach that value.
  5. Load sample populates a nested document so you can see how the tree behaves before pasting your own data.

Why a tree beats a formatted block

Formatting solves the line-by-line readability problem. It does not solve the navigation problem, and for large documents the navigation problem is the harder one.

Consider an API response with a hundred records, each with thirty fields, nested four levels deep. Formatted, that is three thousand lines and a great deal of scrolling, and the structure only becomes apparent if you read carefully enough to track the indentation. As a tree with the first two levels open, it is a list of a hundred collapsed rows and you can see the shape immediately.

The tree also solves the width problem. Indentation pushes deeply nested values further right with every level, so a document twelve levels deep becomes a narrow column of text on the right-hand side of the screen. A tree draws one indentation guide per level and keeps values on a readable measure.

The practical split: use a formatter when you are going to copy the text somewhere else or edit it by hand. Use the viewer when your goal is to understand what is in the document.

What the colour coding is telling you

Type information is the most underrated part of a tree view. JSON has six value types, and the difference between two of them is a frequent source of production bugs:

  • Strings are green. This is where API type confusion lives: "42" and 42 look similar in a formatted block and behave completely differently in code. A string sorts lexicographically, so "10" comes before "9".
  • Numbers are amber. Note that JSON has one number type — there is no integer literal — so whether a value arrives as a float depends on what the producer wrote.
  • Booleans are purple. Worth watching, because a boolean-typed field that suddenly arrives as the string "false" is truthy in JavaScript.
  • Null is grey and deliberately dim, so it does not compete for attention with real values.
  • Objects and arrays are the branches, shown with a count of how many members sit inside.

The string-versus-number distinction is the one to watch for. A price field that is sometimes 19.99 and sometimes "19.99" will work in one code path and produce NaN in another, and it is invisible in a formatted block while obvious in a coloured tree.

Using the path list to write code against unfamiliar data

The path list flattens the document into one line per leaf value, using the notation you would actually write to reach it. Numbers and simple identifiers use dot notation; anything else uses bracket notation.

items[0].sku
items[0].price.amount
items[0].price.currency
items[12].tags[3]
meta.pagination.total

Notice the fourth line in that example. The array index is irregular — index 12, tag 3 — and that is exactly the kind of detail a path list surfaces and a manual read misses. If your document is a collection where only some records have a given field, the path list shows you which indices carry it.

The workflow this is built for: paste an unfamiliar API response, copy the path list, and use it as a scaffold for the fields you need to destructure. It is considerably faster than clicking through a tree looking for the right nesting level, and it produces a reference you can keep next to your code. If you then need those paths as a TypeScript interface, generating one by hand from the list is a short step.

One caveat: if an array contains hundreds of elements, the path list is correspondingly long. In that case collapse to the depth you need first, or paste a single record rather than the whole collection.

Handling very large documents

Rendering is the expensive part, not parsing. Every node in the tree is a real DOM element, and browsers slow down measurably somewhere in the tens of thousands of nodes. Three habits keep large documents responsive:

  • Set Depth to 1 or 2 before you view. Collapsed branches are not rendered, so starting shallow and expanding only the path you need keeps the node count low. Set Depth to All on a large document and you may wait.
  • Slice the document rather than viewing all of it. If you need to inspect one record out of five thousand, copy that record and view it on its own.
  • Format instead when you need the text. If your goal is to copy a section out, the JSON Formatter produces a plain textarea that you can select from directly, with no tree to render at all.

On memory generally: the document is held in the page, so a very large one stays in memory until you navigate away. Reloading the page is the cleanest way to release it.

JSON Lines and arrays of records

Data that arrives one record per line — logs, exports, streamed results — is not a single JSON document, so the viewer will report an error. Wrapping the records in an array makes it viewable, and the tree then shows one indexed branch per record, which is a convenient way to compare their shapes and spot records where a field is missing.

If a record turns out to be malformed while others are fine, that is useful information in itself: it usually means the export was interrupted mid-write, or that a field contained an unescaped newline and split one record across two lines.

To convert, add a comma between records and wrap the whole thing in square brackets. The JSON Validator will confirm the result parses before you paste it here.

What each view gives you

GoalBest viewWhat you get
Understand the shape of an unfamiliar payloadTreeCollapsible branches, type colours, member counts
Check whether a field is a string or a numberTreeColour coding makes the type obvious at a glance
Get a list of field paths for your codeTree + path listOne dotted path per leaf, in JavaScript notation
Copy a section and edit itFormatted textA plain textarea you can select from directly
Find where a document is brokenValidatorThe parser error with line and column
Inspect a document with 50,000 nodesTree at depth 1Only the top level renders, so it stays responsive

Frequently asked questions

What is a JSON viewer for?
It is for reading structure. A raw JSON string of a few hundred lines tells you almost nothing at a glance; a tree lets you see shape, nesting depth and the types of individual fields immediately, and lets you collapse the parts you are not interested in.
What do the colours mean?
Keys are blue, strings green, numbers amber, booleans purple and null grey. Because the type is colour-coded, spotting a value that arrived as a string when you expected a number takes a second rather than a careful read.
What is the path list for?
It flattens the document into one line per leaf, using dotted and bracketed notation — the exact form you would write in JavaScript to access the value. It is handy for mapping an unfamiliar API response before you write code against it, and for spotting irregular array indices.
Why is a deeply nested branch collapsed by default?
Large payloads can contain thousands of nodes, and rendering them all expanded is slow and unreadable. Limiting the initial depth to the part you actually need to inspect keeps the tool responsive and the view comprehensible.
Is my data safe?
Yes. The tree is built in your browser and nothing is transmitted. String values are inserted as text rather than markup, so a payload containing HTML or script tags is displayed literally and cannot execute.
Can it view JSON Lines?
Not as-is, because each line is a separate document. Wrap the records in an array, with commas between them, and the viewer will show them as indexed items you can compare side by side.
Can I edit the values in the tree?
No, and that is deliberate. A viewer that silently rewrites data is a hazard when you are inspecting a payload you did not author. To make changes, copy the formatted text, edit it, and re-view the result.
Why does the viewer slow down on huge documents?
Each node is a real DOM element, so a document with tens of thousands of values produces a DOM tree of comparable size. Starting at depth 1 and expanding only what you need keeps the rendered node count low and the tool fast.
Does it show array indices?
Yes. Arrays are shown as indexed branches, and the index appears in the path list in bracket notation. This is useful for spotting irregular structures, such as a field present on some records but not others.
Scroll to Top