# Online JSON5 Viewer: Collapsible Tree View | JSON5.dev


Source: https://json5.dev/tools/online-viewer/

---

# Online Tree Viewer: JSON5

See the structure of any JSON5 or JSON file as a collapsible tree.

Paste a document and the viewer parses it with the reference JSON5 parser, then draws every object, array and value as a tree you can open and close. Keys, strings, numbers, booleans and null are colored by type, and the counts under the tree tell you how many values the document holds and how deeply it nests.

It is the quickest way to read a large config or an API response without scrolling through braces. If the text does not parse, you get the line, column and surrounding lines of the error instead. Everything runs locally in your browser; nothing is uploaded.

![A JSON5 document unfolding into a glowing collapsible tree of objects, arrays and values](https://json5.dev/img/hero/tools-online-viewer.png)

**TL;DR:** Paste JSON5 or JSON below to see it as a tree. Click a key to open or close it, or use Expand all and Collapse all. Values are what the parser produced, so comments are not shown and `0x1F90` appears as `8080`.

## View JSON5 as a Tree

A sample service config is loaded. Replace it with your own text.

JSON5 input

Tree

      

**Private by design:** parsing and drawing happen in your browser. Your text is never uploaded, logged or sent to any server, and it is gone when you close the tab. Open file and drag and drop read the file inside your browser. Copy link puts the text in the part of the address after the # sign, which browsers do not send to any server.

![Structure icon](https://json5.dev/images/icons/structure.png)

## How to Read the Tree

-   **Objects and arrays** show a small arrow and a summary such as `Object` or `Array[3]`. Click the row to open or close it.
-   **Closed nodes preview their contents** when you hover over them, so you can find the branch you want without opening everything.
-   **Values are colored by type:** strings, numbers, booleans and `null` each have their own color, so a quoted `"8080"` is easy to tell from the number `8080`.
-   **Long arrays are split into groups of 100** so a large data file stays responsive.
-   **The tree opens two levels deep** when it is first drawn. Expand all opens every level; Collapse all closes everything below the top.

The summary under the tool counts every value in the document (including the containers), the number of objects and arrays, and the deepest level of nesting, counting the top-level value as level 0.

![Info icon](https://json5.dev/images/icons/info.png)

## The Tree Shows Parsed Values

The viewer draws the data the parser returns, not the text you typed. That is what a program reading the file will see, which is usually what you want to check, but it means some things in the source do not appear:

In your text

In the tree

Comments (`// ...` and `/* ... */`)

Not shown; comments are not data

`0x1F90`, `+5`, `.5`

`8080`, `5`, `0.5`

`Infinity`, `NaN`

Shown as the numbers `Infinity` and `NaN`

Single-quoted strings, unquoted keys

Plain strings and keys

A repeated key

Only the last value, which is what the reference parser keeps

A trailing comma

No trace; it changes nothing in the data

To check exactly which syntax a file uses, keep the source next to the tree, or run it through the [validator](https://json5.dev/tools/online-validator/). To change the text and keep its comments, see [editing JSON5 without losing comments](https://json5.dev/tutorials/preserving-comments/).

![Idea icon](https://json5.dev/images/icons/idea.png)

## When a Tree Helps

**Reviewing a large config.** A service or build config of a few hundred lines is hard to follow in text. Collapse everything, then open one branch at a time.

**Checking what a typo did.** A missing comma or an extra brace can put a key inside the wrong object while the file still parses. In the tree, a key that sits at the wrong level is obvious.

**Reading an API response.** Paste a one-line JSON response and read it as a tree. JSON is valid JSON5, so any JSON works.

**Confirming types.** The colors show whether a version, port or flag is a string or a number, a common source of bugs when a file is edited by hand.

## FAQ

### Why are my comments missing from the tree?

The tree shows parsed data, and a parser discards comments. Your input text is unchanged.

### Does it work with plain JSON?

Yes. Every JSON document is valid JSON5.

### How large a file can it show?

It depends on your device. Parsing and drawing happen in the browser tab, and long arrays are grouped to keep the page responsive. For multi-megabyte files, a desktop browser works best.

### Is my text uploaded?

No. Nothing leaves your browser.

## See Also

[![Checklist icon](https://json5.dev/images/icons/checklist.png)

### Online Validator

Find syntax errors with line and column

](https://json5.dev/tools/online-validator/)[![Text format icon](https://json5.dev/images/icons/text-format.png)

### Online Formatter

Pretty-print with your indent and quotes

](https://json5.dev/tools/online-formatter/)[![Convert icon](https://json5.dev/images/icons/convert.png)

### Online Converter

JSON5 to JSON and back

](https://json5.dev/tools/online-converter/)

The tree is drawn by [json-formatter-js](https://github.com/mohsen1/json-formatter-js) 2.5.23 by Mohsen Azimi (MIT license), and parsing uses the reference [json5](https://github.com/json5/json5) library, both bundled with this site.
