JSON Tree Viewer
Paste JSON and explore it as an interactive collapsible tree. Search, copy paths, and inspect values at any depth.
Paste JSON and explore it as a collapsible, colour-coded tree. Click nodes to expand or collapse, search for keys or values, and copy dot-notation paths with one click. This is useful for navigating deeply nested API responses, configuration files, and complex data structures. Everything runs in your browser - nothing is sent to a server.
About JSON Tree Viewer
How Does a JSON Tree Viewer Work?
The tool parses your JSON using the browser's built-in JSON.parse() method, then recursively walks the resulting object to build a tree structure. Each key-value pair becomes a node. Objects and arrays become expandable parent nodes, while strings, numbers, booleans, and null values become leaf nodes. The tree is rendered with indentation to show nesting depth, and each value type gets a distinct colour so you can scan the structure at a glance.
Worked example: Given this JSON from an API response:
{"user": {"id": 42, "name": "Alice", "roles": ["admin", "editor"], "active": true}}
The tree viewer creates five nodes. The root "user" object expands to show "id" (number, blue), "name" (string, green), "roles" (array with 2 items), and "active" (boolean, amber). Clicking the "roles" arrow expands it to show [0]: "admin" and [1]: "editor". Hovering over "name" and clicking "path" copies user.name to your clipboard - ready to paste into code as data.user.name.
Tree Viewer vs Formatter
Both tools handle JSON, but they solve different problems. A JSON Formatter pretty-prints raw JSON as indented text - good for cleaning up minified responses or validating syntax. The tree viewer turns JSON into a navigable structure you can explore interactively, which is better when you need to find a specific value buried several levels deep.
| Feature | Tree Viewer (this tool) | JSON Formatter |
|---|---|---|
| Display | Interactive collapsible tree | Indented text with syntax highlighting |
| Navigation | Click to expand/collapse any node | Scroll through text |
| Search | Filter tree to matching nodes | Browser find (Ctrl+F) |
| Path copying | Copy dot-notation path to any value | Not available |
| Validation | Shows parse errors | Shows parse errors with location |
| Minify/format | Not available | Both minify and format |
| Best for | Exploring nested structures, finding values | Formatting, validating, copying clean JSON |
Colour-Coded Value Types
JSON has six value types defined in RFC 8259 (published December 2017 by the IETF). The tree viewer assigns each type a distinct colour against the dark background, making it easy to distinguish strings from numbers, booleans from null, and spot structural patterns.
| Type | Colour | Example | Common In |
|---|---|---|---|
| String | Green | "hello world" | Names, IDs, URLs, dates |
| Number | Blue | 42, 3.14, -1 | Counts, prices, coordinates |
| Boolean | Amber | true, false | Flags, toggles, permissions |
| Null | Red | null | Missing or unset values |
| Object | Bracket indicator with key count | {5 keys} | Nested records, config groups |
| Array | Bracket indicator with item count | [3 items] | Lists, collections, results |
This colour coding lets you scan the structure quickly and spot the value types you are looking for without reading every entry. For example, all the red null values in an API response immediately highlight missing fields that might cause bugs in your code.
Navigating Nested JSON
Real-world JSON from APIs is often deeply nested - 5, 10, or more levels deep. REST APIs commonly return paginated arrays of objects, each containing nested sub-objects. GraphQL responses can be even deeper since queries can traverse relationships across multiple entities. The tree viewer makes this manageable by letting you collapse branches you are not interested in and expand only the path you need.
| Action | How | When to Use |
|---|---|---|
| Expand a node | Click the arrow or node label | Drill into a specific branch |
| Collapse a node | Click the expanded arrow | Hide branches you have finished exploring |
| Expand all | Use the Expand All button | Small JSON where you want to see everything |
| Collapse all | Use the Collapse All button | Reset after exploring, or with large JSON |
| Search | Type in the search box | Find a specific key or value in large structures |
| Copy path | Hover and click the path icon | Get the accessor path for your code |
A practical tip: when exploring a large API response for the first time, start with everything collapsed. Expand the top-level keys to understand the shape of the data, then drill into the branch you need. This is much faster than scrolling through hundreds of lines of formatted text.
How Does Path Notation Work?
When you copy a path, it uses dot notation for object keys and bracket notation for array indices. This matches the syntax used in JavaScript, Python (with slight modification), and most JSONPath libraries. The JSONPath query language was standardised in RFC 9535 (published February 2024) and uses a similar dot-and-bracket approach, though with a $ root prefix.
| JSON Structure | Copied Path | JavaScript Access |
|---|---|---|
| Top-level key | name | data.name |
| Nested key | address.city | data.address.city |
| Array element | users[0] | data.users[0] |
| Nested in array | users[0].email | data.users[0].email |
| Deeply nested | response.data.items[2].metadata.tags[0] | data.response.data.items[2].metadata.tags[0] |
The path you copy can be used directly in JavaScript with bracket or dot notation. In Python, swap dots for bracket access: data["user"]["name"]. In jq (the command-line JSON processor), prefix with a dot: .user.name. The paths also work with lodash's _.get() function and similar accessor utilities in most languages.
Common JSON Sources for Tree Viewing
Developers encounter JSON in almost every part of modern software. Douglas Crockford first specified the format in the early 2000s (the first JSON message was sent in April 2001), and it has since become the default data interchange format for web APIs. Of the ten most popular web APIs, only one returns XML rather than JSON.
| Source | Typical Structure | What to Look For |
|---|---|---|
| REST API response | {"data": [...], "meta": {...}} | Pagination info, nested objects in data array |
| GraphQL response | {"data": {"query": {...}}, "errors": [...]} | Nested query results, error details |
| package.json | {"dependencies": {...}, "scripts": {...}} | Dependency versions, script commands |
| Terraform state | {"resources": [...], "outputs": {...}} | Resource attributes, state values |
| AWS CloudFormation | {"Resources": {...}, "Outputs": {...}} | Resource properties, parameter values |
| Kubernetes manifests | {"apiVersion": "...", "kind": "...", "spec": {...}} | Container specs, resource limits, volume mounts |
| OpenAPI/Swagger | {"paths": {...}, "components": {...}} | Endpoint definitions, schema references |
Performance Tips for Large JSON
The tool runs entirely in the browser using JSON.parse(), which is fast for most files. However, very large JSON (over a few megabytes) may take a moment to render as a tree because every node creates a DOM element. Browser JSON.parse() can handle multi-megabyte strings, but the memory cost is typically 2-3x the string size since both the raw text and the parsed object exist in memory simultaneously.
For better performance with large files:
- Keep top-level nodes collapsed and only expand the branches you need
- Use the search function to jump directly to the key or value you are looking for
- If you only need a subset of the data, trim the JSON before pasting
- For files over 10 MB, consider using the JSON Formatter instead, which renders as plain text and handles larger inputs more efficiently
JSON Syntax Quick Reference
If the tree viewer shows a parse error, the issue is usually one of these common mistakes. JSON is stricter than JavaScript object literals - no trailing commas, no single quotes, no comments, and all keys must be double-quoted strings.
| Mistake | Invalid JSON | Valid JSON |
|---|---|---|
| Trailing comma | {"a": 1, "b": 2,} | {"a": 1, "b": 2} |
| Single quotes | {'key': 'value'} | {"key": "value"} |
| Unquoted keys | {key: "value"} | {"key": "value"} |
| Comments | {"a": 1} // comment | {"a": 1} |
| Undefined | {"a": undefined} | {"a": null} |
| Single value | hello | "hello" |
These rules come from the ECMA-404 standard (first published 2013) and RFC 8259. If you are pasting output from a JavaScript console, you may need to replace single quotes with double quotes and remove any trailing commas or comments before the tree viewer can parse it.
JSON in Different Languages
The paths this tool generates use JavaScript dot-and-bracket notation, but the tree structure maps to data types in every major programming language. Understanding these mappings helps when you copy a path from the viewer and need to access the same value in your codebase.
| JSON Type | JavaScript | Python | Go | Java |
|---|---|---|---|---|
| Object | Object / Map | dict | map[string]interface{} | Map or POJO |
| Array | Array | list | []interface{} | List or Array |
| String | string | str | string | String |
| Number | number (float64) | int or float | float64 | int, long, double |
| Boolean | boolean | bool | bool | boolean |
| Null | null | None | nil | null |
One thing to note: JSON numbers do not distinguish between integers and floating-point values. The spec (RFC 8259) defines all numbers as a single type. Most parsers will map small whole numbers to integers and anything with a decimal point or exponent to a float, but the exact behaviour depends on the library. JavaScript stores all numbers as 64-bit floats, which means integers above 2^53 - 1 (9,007,199,254,740,991) lose precision. If your API returns large IDs, the tree viewer will display them accurately as strings but numeric IDs may be silently rounded. This is a known limitation of JSON.parse() in all browsers.
When to Use a Tree Viewer Instead of grep or jq
Command-line tools like jq and grep are powerful for scripting, but a visual tree viewer is better for exploratory work. If you do not yet know the exact path to the value you need, clicking through a tree is faster than guessing jq filters. The search function is especially useful when you know a value exists somewhere in the JSON but not where - type part of the value and the tree filters down to matching nodes.
Typical scenarios where a tree viewer saves time:
- Exploring an unfamiliar API response for the first time
- Debugging a webhook payload where the structure varies between event types
- Checking Terraform state files to verify resource attributes before running apply
- Inspecting CI/CD pipeline output (GitHub Actions artifacts, Jenkins build metadata)
- Reviewing exported data from databases or analytics platforms
Once you have found the path you need using the tree viewer, copy it and use it in your code or jq command. The viewer acts as a visual discovery step before writing the automated access logic.
For converting JSON to other formats, the JSON to CSV Converter handles tabular data and the YAML to JSON Converter switches between config formats. If you need to decode a JWT token (which contains Base64-encoded JSON segments), the JWT Decoder will parse the header and payload for you. All processing happens in your browser - your data stays private.
Sources
Frequently Asked Questions
How is this different from a JSON formatter?
A JSON formatter pretty-prints your JSON as indented text. The tree viewer shows it as a navigable tree structure where you can expand and collapse individual nodes, search for keys or values, and copy the path to any property.
Can I search within the JSON?
Yes. Type in the search box to filter the tree to nodes matching your query. It searches both keys and values, hiding branches that do not contain matches.
How do I copy a path to a specific value?
Hover over any node in the tree and click the path button that appears. This copies the dot-notation path like data.users[0].name to your clipboard, ready to use in your code.
Is there a size limit?
The tool runs in your browser so it can handle reasonably large JSON files. For very large files (over a few megabytes), the tree may take a moment to render. Collapsing top-level nodes helps with performance.
Is my JSON data kept private?
Yes. Everything is processed locally in your browser. Your JSON is never uploaded to any server.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/json-tree-viewer/" title="JSON Tree Viewer - Free Online Tool">Try JSON Tree Viewer on ToolboxKit.io</a>