JSON Formatter & Validator→Specialized Version
{ }

JSON Path Finder

Find paths in JSON

JSON Path Finder

Navigate and extract data from complex JSON structures using path notation. Find the exact path to any element in your JSON for use in code, queries, or data extraction.

JSON Path Notation

NotationMeaningExample
$.propertyRoot property$.name
.propertyChild property$.user.name
[n]Array index$.items[0]
[*]All elements$.items[*]
..propertyRecursive descent$..name

Path Examples

``javascript const data = { user: { name: "John", email: "john@example.com", orders: [ { id: 1, total: 99.99 }, { id: 2, total: 149.99 } ] } };

// Paths to values: // $.user.name → "John" // $.user.email → "john@example.com" // $.user.orders[0].id → 1 // $.user.orders[1].total → 149.99 // $.user.orders[*].total → [99.99, 149.99] `

Path Implementation

`javascript // Simple path extraction function getValueByPath(obj, path) { return path .replace(/\[(d+)\]/g, '.$1') .split('.') .filter(Boolean) .reduce((acc, key) => acc?.[key], obj); }

// Usage getValueByPath(data, 'user.orders[0].total'); // 99.99 getValueByPath(data, 'user.name'); // "John" `

Using JSON Path Libraries

`javascript // JSONPath library const jsonpath = require('jsonpath');

// Query examples jsonpath.query(data, '$.user.name'); // ["John"]

jsonpath.query(data, '$..total'); // [99.99, 149.99]

jsonpath.query(data, '$.user.orders[?(@.total > 100)]'); // [{ id: 2, total: 149.99 }] `

Common Use Cases

Use CasePath Example
Access nested data$.data.users[0].profile
API responses$.response.results[*]
Configuration$.settings.database.host
Test assertionsexpect($.data.id).toBe(1)
Use this tool to find the correct path for any JSON element.

Numbers Are the Recurring Problem

A JSON number is an IEEE 754 double. Three consequences that bite in production:

ValueWhat happens
Integers above 2⁵³Silently lose precision — send IDs as strings
Money as a float0.1 + 0.2 = 0.30000000000000004
Leading zeros007 is invalid JSON; "007" is a string
NaN and InfinityNot valid JSON at all
Twitter hit the first one publicly: 64-bit tweet IDs arrived in JavaScript rounded, so the API began sending an id_str alongside every id.

Keys, Order and Duplicates

Objects are formally unordered, though every JavaScript engine preserves insertion order for string keys — with one exception: integer-like keys sort numerically and come first.

`javascript JSON.stringify({ b: 1, 2: 2, a: 3 }); // {"2":2,"b":1,"a":3} `

Duplicate keys are not an error in the spec, and JSON.parse keeps the last one. Two parsers can legitimately disagree about which value wins, which has been the basis of real request-smuggling attacks.

Rules That Prevent Most JSON Bugs

RuleWhy
No trailing commas{"a": 1,} is invalid JSON, though JavaScript accepts it in object literals
Double quotes only{'a': 1} is not JSON
Keys must be quoted{a: 1} is a JavaScript object, not JSON
No commentsThere is no comment syntax; JSON5 and JSONC are different formats
No undefined, NaN, InfinityJSON.stringify silently drops or nulls them
Numbers are IEEE 754 doublesIntegers above 2⁵³ lose precision — send them as strings

Parsing Safely

`javascript try { const data = JSON.parse(text); } catch (error) { // The message names the character offset, which is the fastest way // to find an unescaped quote in a large document. console.error(error.message); } `

JSON.parse` throws on invalid input rather than returning null, so it always belongs in a try/catch when the source is a file, a request body or a clipboard paste.

Frequently Asked Questions

What is JSON Path when working with JSON Path Finder?

JSON Path is a query language for extracting data from JSON, similar to XPath for XML. It uses dot notation ($.user.name) and bracket notation ($.items[0]) to navigate through JSON structures. Libraries like jsonpath implement advanced features like wildcards, filters, and recursive descent.

What does $.. mean in JSON Path?

The double-dot (..) means recursive descent—search all descendants for the property. For example, $..name finds all "name" properties anywhere in the JSON, regardless of depth. This is useful when you don't know the exact path or want to extract all matching values.

How do I extract all items from a JSON array?

Use [*] to select all elements: $.items[*] returns all items in the array. You can also chain properties: $.items[*].name returns the name of every item. Most JSON Path libraries return results as an array.

Related Tools

Explore other tools you might find useful:

More JSON Formatter & Validator tools

You might also need