JSON Viewer

Explore JSON as a collapsible tree and copy the path to any value.

  • Runs in your browser
  • Free, no sign-up
Tree

The tree appears here.

Path Click any value to see its path
Paste JSON to start

About the JSON Viewer

Large JSON is hard to follow as plain text. The JSON Viewer turns it into a tree you can fold and unfold, so you can open only the part you care about and leave the rest closed.

Click any value and the viewer shows its path, written the way you would use it in code: store.books[1].title in JavaScript style or $.store.books[1].title in JSONPath. Copy the path or the value with one click. That saves you from counting brackets and array positions when you write code, tests or API queries.

A search box finds keys and values anywhere in the document and opens the tree to show every match. The JSON is checked as you paste, with the exact line and column of any error. It all runs in your browser, so your data never leaves your device.

How to use it

  1. Add your JSONPaste it into the JSON box, drop a .json file onto it, or use Open file. Sample loads a small bookstore example.
  2. Explore the treeClick the arrow next to an object or array, or double-click its row, to open or close it. Expand all and Collapse all work on the whole tree.
  3. Click a valueThe path bar under the tree shows where that value sits. Switch between JavaScript and JSONPath style at any time.
  4. SearchType in "Search keys and values". Matching rows are highlighted and the branches that contain them open automatically.
  5. Copy what you needCopy path puts the path on your clipboard. Copy value copies the selected value: plain text for strings, indented JSON for objects and arrays.

Key features

Collapsible tree

Objects show their number of keys, like {4}, and arrays their number of items, like [2], so you know what is inside before you open it.

Two path styles

JavaScript paths such as store.address.city and JSONPath such as $.store.address.city, with brackets and quotes added for keys that need them.

Search everywhere

Finds text in keys and values, ignoring upper and lower case, and opens every branch that holds a match.

Copy values cleanly

Strings are copied without their quotes, numbers exactly as written, and objects and arrays as JSON indented with 2 spaces.

Error locations

Invalid JSON is reported with its line, column and a plain-language reason, such as a trailing comma or a missing bracket.

Private by design

The tree is built in your browser. Nothing is uploaded or stored.

Examples

Exploring the sample

The Sample button loads a 348-byte bookstore record on one line. Above the tree you see 20 keys ยท depth 5. The tree opens two levels deep:

{1}
  "store": {6}
    "name": "Corner Books"
    "open": true
    "rating": 4.7
    "address": {4}
    "books": [2]
    "staff": 2

That is 8 rows. Expand all opens everything and shows 26 rows, including both books with their titles, authors, prices and tags.

Paths for the values you click

You clickJavaScript path
"Cooking with Lentils"store.books[1].title
"Portland"store.address.city
"travel"store.books[0].tags[1]

Array positions start at 0, so books[1] is the second book and tags[1] is the second tag. Switch to JSONPath and each path starts with $. instead, such as $.store.books[1].title.

When a key has spaces, a hyphen or another character that is not allowed in a plain name, the path switches to brackets. For a key called first name inside user:

StylePath
JavaScriptuser["first name"]
JSONPath$.user['first name']

Searching

SearchFoundMatches
portland1"city": "Portland"
title2both "title" keys
122"12 Market St" and 12.99
null1"signed": null

Search ignores case, so "FICTION" finds the "fiction" tag too. Array positions are not searched, only keys and values.

Copying a whole branch

Click the "address" row and press Copy value. You get the object as indented JSON:

{
  "street": "12 Market St",
  "city": "Portland",
  "state": "OR",
  "zip": "97204"
}

Tips

  • Use the JavaScript path style when writing code and JSONPath when a tool asks for it, such as API testing tools, database queries or log filters.
  • Search for a field name to find every place it appears. With arrays of records, that quickly shows which items have the field and which do not.
  • Copy value on an object or array gives you clean, indented JSON for just that branch, which is handy for test fixtures and bug reports.
  • If the JSON does not load, read the error in the status line. It gives the exact line and column, and the JSON Formatter can help you fix and re-indent it.
  • Collapse all puts the tree back the way it first opened, which is a quick way to get the big picture again after a deep search.

Common mistakes and limits

  • Forgetting that arrays start at 0The first item of an array is [0], the second is [1]. A path like books[1] points to the second book, not the first.
  • Pasting JSON with comments or trailing commasThe viewer follows the JSON standard, so comments, single quotes and trailing commas are errors. Remove them and the tree appears.
  • Expecting very large trees to open completelyExpand all stops after the first 5,000 items so the page stays responsive, and search highlights at most 500 matches (shown as "500+ found").
  • Searching for an array positionSearch looks at keys and values only. To find the fifth item of an array, open the array and look for the row marked 4.
  • Editing in the treeThe tree is read-only. Change the JSON in the box on the left and the tree updates right away.

Frequently asked questions

What is a JSON viewer?
A tool that shows JSON as a tree of objects, arrays and values that you can open and close, instead of one long block of text. It makes large or deeply nested data much easier to read.
What is the difference between the JavaScript and JSONPath styles?
They point to the same value. JavaScript style (store.books[0].title) is what you write in code. JSONPath ($.store.books[0].title) starts with $ and is used by many query and testing tools.
How do I get the path to a value?
Click its row. The path appears under the tree, and Copy path puts it on your clipboard.
Why does my path use brackets and quotes?
Keys with spaces, hyphens or other special characters, or keys that start with a digit, cannot be written with a dot. The viewer uses ["key"] in JavaScript style and ['key'] in JSONPath for them.
Does search look at keys or values?
Both. It matches any part of a key or a value, ignoring upper and lower case. Numbers, true, false and null are searched as they are written.
What does {6} or [2] mean in the tree?
An object shows how many keys it has in curly braces, and an array shows how many items it has in square brackets.
Can it open big files?
Files up to 10 MB can be opened. Above 300,000 characters, the tree updates a moment after you stop typing. Expand all opens up to 5,000 items.
Can I use the path in my code?
Yes. The JavaScript style is valid JavaScript after the name of your variable. If your parsed data is in a variable called data, store.books[1].title becomes data.store.books[1].title.
Is my JSON uploaded?
No. Everything runs in your browser. Nothing is sent to a server or saved.