Format Code Now
/

JSON Viewer

FV-06

Paste JSON to see it as an indented tree. Each line shows the path of a value, its type and the value itself, such as address.city: string "London". Paths only gives a plain list of paths.

Runs in your browser. Nothing is uploaded.

JSON

Tree

How to use it

  1. Paste your JSON into the input box, or open a .json file (up to 5 MB) or drop it on the box.
  2. Read the Tree output: each value sits on its own line with its full path and type, indented by depth.
  3. Choose the path style: address.city or $.address.city.
  4. Press Paths only for a list of the path to every value, without types or values.
  5. For a long array, pick First 5, First 20 or First 100 under Array items shown.

How the tree is laid out

Objects and arrays get a line with their size, such as object {5 keys} or array [2 items]. Their children follow, indented two spaces further. Every other value shows its path, its type (string, number, boolean or null) and its value. Keys that are not plain identifiers, for example a key with a space, are written as ["a b"]. Array positions are written as [0], [1] and so on, counted from zero.

Exact values and what it is not

Numbers and strings are printed exactly as they appear in the input, so a 20 digit ID is not rounded and an escape such as \u00e9 stays as typed. This is a text tree. You cannot collapse or expand nodes, and it does not search. If an object repeats a key, the last one is shown, which is what a parser would keep. It does not edit the JSON.

Paths only and path styles

Paths only lists the path of each value that has no children, plus any empty object or array, one per line. Use it to find the path to a field in a large response. Dot style writes address.city and tags[0]. JSONPath style adds a leading $, as in $.address.city, which is the form many query tools expect.

Error messages and what to do

MessageWhat it meansFix
Expected a string keyInside an object the parser wanted a key in double quotes.Put the key in double quotes or remove the comma before the closing brace.
Unexpected characterA character that cannot start a JSON value, such as a single quote, NaN or undefined.Replace it with a valid JSON value.
Unexpected end of inputThe text ended while a value or bracket was still open.Add the missing value, closing brace or closing bracket.

Questions people ask

How do I view JSON as a tree online?

Paste the JSON into the input box. The Tree output shows one line per value with its path and type, indented by depth. Objects and arrays show how many keys or items they hold. It runs in your browser.

How do I find the path to a value in JSON?

Paste the JSON and press Paths only, or read the path at the start of each Tree line. Dot style gives address.city and tags[0]. Choose the JSONPath style to get the same paths with a leading $.

Can I collapse and expand nodes?

No. The output is plain text, so there is nothing to click. For a long array you can limit the lines to the first 5, 20 or 100 items, and a line tells you how many items were left out.

Does the viewer show big numbers exactly?

Yes. Numbers are printed as they appear in your input, so a long ID such as 12345678901234567890 is not rounded. The same goes for strings with escapes, which are shown as written.

What happens if a key appears twice in an object?

The viewer shows the last value for that key, because that is what a JSON parser keeps. If you want a warning about repeated keys, run the text through the JSON Validator, which reports them.

What is the difference between this and a JSON formatter?

A formatter returns the same JSON with different spacing. The viewer returns a different view: one line per value with its path and type. Use the viewer to locate a field and the formatter to tidy a document.

About this tool

Shows every value on its own line with its full path and type, indented by depth. This is a text tree, not a clickable one: you cannot collapse nodes. Numbers and strings are printed exactly as they appear in the input, so large IDs and escapes are not changed. If an object repeats a key, the last one is shown, as a parser would. Paths only lists the path of each value that has no children, plus any empty object or array.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.