Skip to the content
Olbo

Guides

How to find the path to a value in a JSON file

To find the path to a value in a JSON file, search for the key or the value and read off the keys and list positions that lead to it. In Olbo's JSON tool you open or paste the JSON, press Find, type what you are looking for and press Enter to select the first match. The Path bar above the tree then shows where it sits, as in items[3].user.email, and Copy puts that path on your clipboard.

Open JSON

Step by step

  1. Open the JSON file, or paste the JSON in.Press Open a JSON file. To paste instead, press "or paste some JSON", paste into the box, and press Tree to see it as a tree.
  2. Press Find and type a key or a value.Find searches every key and every value, and ignores capital letters unless you tick Match case. It says how many matches it found. On a computer Ctrl+F or Cmd+F opens it too, and on a phone it is behind the three-dot button.
  3. Press Enter to go to each match in turn.Each press selects the next match, and Shift+Enter goes back. On a phone, use the ‹ and › buttons beside the count. The tree highlights the match, and on a computer the find bar shows it too.
  4. Press Copy beside the path.The Path bar above the tree shows where the selected value sits. Copy puts the path on your clipboard, and the word copied appears beside it.

How a JSON path is written

Keys are joined with dots, and positions in a list go in square brackets, counting from 0. So items[3].user.email is the email of the user in the fourth entry of items. A key that is not a plain word, such as one with a space in it, goes in brackets and quotes, as in ["first name"], and the whole file is $.

That is how JavaScript code reaches a value: data.items[3].user.email, if your JSON is in a variable called data. Tools that use JSONPath write the same path with $ in front, as in $.items[3].user.email.

Walking the tree yourself, and big files

You do not have to search. Pressing a row in the tree selects it and shows its path, and opens or closes it if it has anything inside.

The tree only draws what you open. A closed part of the file is one row however much is inside it, and a long list shows its first 200 entries, then a line saying how many more there are. Find searches the whole file, including parts the tree has not drawn. For a match further down a long list, the Path bar shows its path and Copy works, and pressing that line draws more of the list so you can see the row. Find counts up to 5,000 matches and then shows 5,000+, so type a little more to narrow it down.

More guides

Olbo is an office suite that runs in your browser. Your files are read on the machine you are sitting at and are never uploaded. See all the tools.