JSON Path Finder

Find all paths to values in a JSON object for querying

About This Tool

Walks a JSON document and emits the dotted or bracket-notation path to every leaf value. Output supports JSONPath syntax ($.foo.bar[0]) and dot notation (foo.bar.0). Useful for building queries against API responses or constructing JMESPath/jq expressions during data exploration.

Nested arrays and objects are traversed recursively. Special characters in keys trigger automatic switch to bracket notation to keep paths machine-parseable. Path output may be filtered by leaf type or value pattern.

The traversal algorithm is a depth-first walk maintaining a path stack. At each node, the type is checked: a primitive emits a path; an array recurses with numeric indices; an object recurses with string keys. Keys containing dots, brackets, or other reserved characters trigger bracket notation with proper escaping. The output preserves source order for arrays and observed insertion order for objects, matching how most JSON parsers handle the input.

Path notation differences matter for downstream consumers. JSONPath ($.store.book[0].title) is supported by JavaScript libraries, Postman, and many API testing tools. JMESPath (store.book[0].title) is the AWS standard, used in CLI queries and serverless transformations. jq has its own syntax (.store.book[0].title) closely resembling JSONPath without the leading $. Dot notation with numeric segments (store.book.0.title) is used by Lodash get/set and various form libraries.

A worked example for input {"users":[{"id":1,"name":"Alice","email":"a@b"},{"id":2,"name":"Bob"}]}: paths generated include $.users[0].id, $.users[0].name, $.users[0].email, $.users[1].id, $.users[1].name. Notice that $.users[1].email is absent because Bob lacks the field — the walker emits paths only for present leaves. Filtering by value pattern (e.g., regex /@/) would isolate the email path. Filtering by type "string" would exclude the numeric IDs.

The "find" framing implies an exploratory use case: a developer pasting a sample API response and asking "what's the path to the field I want?" This is where the tool earns its keep. Reading a deeply nested response and tracing each hop manually is error-prone; the path list gives you a complete index. Pasting the chosen path into jq or a JavaScript get() call usually works on the first try.

Limitations: the tool does not infer schema. Two records with different shapes both produce paths; a downstream query for $.users[0].email succeeds while $.users[1].email returns undefined. Detecting optional fields requires comparing path sets across multiple records. Very large documents (over ~50 MB) become unresponsive in-browser; jq from the command line handles arbitrary sizes. Recursive structures (which are not strictly valid JSON but appear in serialized form occasionally) cause infinite loops without cycle detection — the tool aborts at a configurable depth limit.

The about text and FAQ on this page were drafted with AI assistance and reviewed by a member of the Coherence Daddy team before publishing. See our Content Policy for editorial standards.

Frequently Asked Questions