Runs in your browser · nothing uploaded Waiting for input

Input

Tree

The tree appears here as you type.

Ctrl+Enter run / or Ctrl+K search tools Press Ctrl+D to bookmark this page

What a JSON tree viewer is for

Formatted JSON is fine for a short file, but an API response with hundreds of nested fields turns into a long scroll. A tree shows the structure instead: every object and array is a row you can open or close, with a count of what is inside, so you can go straight to the part you need and ignore the rest.

Select any row to see its path, then copy the path or the value. That is the quickest way to find out what to write in your code to reach a field, for example data.result.user["first-name"].

How to use the JSON viewer

  1. Paste or type JSON into the Input box, or drop a .json file onto it. The tree updates as you type.
  2. Click the arrow next to a row to open or close it, or use Expand all, Collapse all and the Levels buttons.
  3. Select a row to see its path. Use Copy path, Copy value or Open in JSON Formatter for that part of the document.
  4. Search keys, values or both. Turn on Filter to hide everything except the matches and the rows that lead to them.

Keyboard

KeyWhat it does
↑ ↓Move to the previous or next row
→Open the row, or move to its first child
←Close the row, or move to its parent
Enter or SpaceOpen or close the row
*Open every row at the same level
Home End Page Up Page DownJump through the tree

Three ways to write a path

The same field can be written in different path styles, depending on where you use it. Choose your usual one under Path style; the other two are always in the copy menu.

StyleExampleUsed in
JavaScriptdata.items[0]["first-name"]JavaScript and TypeScript code, browser consoles
JSONPath$.items[0]['first-name']JSONPath testers, API gateways, test tools and many query libraries
JSON Pointer/items/0/first-nameJSON Patch, JSON Schema $ref and OpenAPI. A / in a key is written ~1 and a ~ as ~0

Values are shown exactly as written

Many viewers read JSON with the browser's JSON.parse, which rounds whole numbers above 253: an order ID like 12345678901234567890 is shown as 12345678901234567000. This viewer reads the text itself, so big IDs, 1.10, 1e5 and string escapes appear just as they are in your input, and copying a part of the tree gives you the original text.

If an object repeats a key, both entries are shown and the second gets a duplicate key badge. Most programs keep only the last value, which is a common cause of confusing bugs.

Numbers that look like Unix times, with 10 digits (seconds) or 13 digits (milliseconds) between the years 2000 and 2100, show their date in UTC next to them. Turn this off under Timestamp hints.

Large files

  • Files of several megabytes are read in a background worker, so typing and scrolling stay smooth.
  • Only the rows on screen are drawn, however many the file has. Very large files open with just the top level showing.
  • Long strings are shortened in their row. Select the row to see the full value above the tree, and turn on Wrap long strings to wrap it.
  • Files you drop in are read in your browser and never uploaded. Inputs over 1 MB are not remembered for your next visit.

When the JSON is not valid

Instead of an empty tree, you get a list of problems with their line and column, in plain words. Click a problem to jump to it in the input. Common slips such as trailing commas, single quotes, unquoted keys and comments can be repaired with Fix it: the tree then shows the repaired JSON, and your input only changes if you choose Replace input with fixed JSON.

Frequently asked questions

Is my JSON sent to a server?

No. The JSON is read and drawn as a tree in your browser. Nothing you paste or drop is uploaded or stored on a server, and there is no save feature that could expose it. You can confirm this in your browser's Network tab.

How large a file can it open?

Files of 5 MB open and scroll smoothly, and larger files usually work too, depending on your device. Big files are read in a background worker and only the rows on screen are drawn, so the page stays responsive.

Why does my number look different in other viewers?

Most viewers use JSON.parse, which rounds whole numbers above 2^53, such as long IDs. This viewer shows every number exactly as written, and copying a value or path never changes it.

Which path style should I copy?

Use JavaScript paths in code, JSONPath in JSONPath tools and API tests, and JSON Pointer for JSON Patch, JSON Schema and OpenAPI references. Pick your usual one under Path style; the others are in the copy menu.

Can I edit the JSON in the tree?

Not in the tree itself. Edit the text in the Input box and the tree updates as you type. To reformat or minify, use Open in JSON Formatter.

Does it remember my JSON?

Yes, on this device only, so the JSON is still there when you come back. Inputs over 1 MB are not remembered. Turn this off in Settings, or press Clear to delete it.

Walk a JSON tree in your code

Print the path and value of every field in Java, JavaScript, Python and Go, the same paths the viewer shows.

Java

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;

public class WalkJson {
    public static void main(String[] args) throws Exception {
        String text = "{\"user\":{\"name\":\"Ada\",\"roles\":[\"admin\",\"editor\"]},\"active\":true}";
        JsonNode root = new ObjectMapper().readTree(text);
        walk(root, "data");
    }

    // Prints the path and value of every leaf, in document order.
    // Keys with spaces or symbols would need ["key"] instead of .key.
    static void walk(JsonNode node, String path) {
        if (node.isObject()) {
            for (Map.Entry<String, JsonNode> e : node.properties()) {
                walk(e.getValue(), path + "." + e.getKey());
            }
        } else if (node.isArray()) {
            for (int i = 0; i < node.size(); i++) {
                walk(node.get(i), path + "[" + i + "]");
            }
        } else {
            System.out.println(path + " = " + node); // toString() gives the JSON text
        }
    }
}

Uses Jackson (com.fasterxml.jackson.core:jackson-databind).

JavaScript

const text = '{"user":{"name":"Ada","roles":["admin","editor"]},"active":true}';
const data = JSON.parse(text);

// Prints the path and value of every leaf, in document order.
// (Object.entries lists integer-like keys such as "10" first.)
function walk(value, path) {
  if (Array.isArray(value)) {
    value.forEach((item, i) => walk(item, `${path}[${i}]`));
  } else if (value !== null && typeof value === 'object') {
    for (const [key, child] of Object.entries(value)) walk(child, `${path}.${key}`);
  } else {
    console.log(`${path} = ${JSON.stringify(value)}`);
  }
}

walk(data, 'data');

JSON.parse rounds integers above 2^53; the viewer above keeps them exact.

Python

import json

text = '{"user":{"name":"Ada","roles":["admin","editor"]},"active":true}'
data = json.loads(text)


def walk(value, path):
    """Prints the path and value of every leaf, in document order."""
    if isinstance(value, dict):
        for key, child in value.items():
            walk(child, f"{path}.{key}")
    elif isinstance(value, list):
        for i, item in enumerate(value):
            walk(item, f"{path}[{i}]")
    else:
        print(f"{path} = {json.dumps(value)}")


walk(data, "data")

Go

package main

import (
	"encoding/json"
	"fmt"
	"strings"
)

func main() {
	text := `{"user":{"name":"Ada","roles":["admin","editor"]},"active":true}`
	dec := json.NewDecoder(strings.NewReader(text))
	dec.UseNumber() // keep numbers as their exact text
	if err := walk(dec, "data"); err != nil {
		fmt.Println("invalid JSON:", err)
	}
}

// walk reads one value and prints the path and value of every leaf.
// Reading tokens keeps the document's key order; a Go map would not.
func walk(dec *json.Decoder, path string) error {
	tok, err := dec.Token()
	if err != nil {
		return err
	}
	delim, isDelim := tok.(json.Delim)
	if !isDelim {
		b, err := json.Marshal(tok)
		if err != nil {
			return err
		}
		fmt.Printf("%s = %s\n", path, b)
		return nil
	}
	for i := 0; dec.More(); i++ {
		child := fmt.Sprintf("%s[%d]", path, i)
		if delim == '{' {
			key, err := dec.Token()
			if err != nil {
				return err
			}
			child = path + "." + key.(string)
		}
		if err := walk(dec, child); err != nil {
			return err
		}
	}
	_, err = dec.Token() // the closing } or ]
	return err
}

Last verified . Each example is run automatically and its output checked.

Settings

Deletes everything this site keeps in your browser: saved inputs, favorites, theme, accent color and tool options.