How to Use the JSON Path Builder
JSONPath is a query language for JSON, similar to XPath for XML. It lets you select and extract specific values from a JSON document using a compact path expression. The JSON Path Builder makes this visual — paste your JSON, click any value in the tree, and instantly get the corresponding JSONPath expression.
- Paste your JSON into the input panel on the left, or click "Load Sample" to try a built-in example.
- Click "Parse & Explore" to render the interactive JSON tree in the right panel.
- Click any value (strings, numbers, booleans, or nulls) in the tree to auto-populate the "Selected Path" box with its JSONPath expression.
- Test expressions by editing the path in the test box and clicking "Test" to see the matched value instantly.
- Copy the path using the copy button and paste it into your code, AWS EventBridge rules, or jq queries.
JSONPath Syntax Reference
$ — Root of the document
$.name — Property "name" on the root object
$.address.city — Nested property access
$.books[0] — First element of the "books" array
$.books[0].title — Property on array element
$.books[*] — All elements of "books" array (wildcard)
$.books[*].author — "author" field from every book
Real-World Use Cases
AWS EventBridge Rules
EventBridge content-based filtering uses JSONPath-like expressions to route events. Use the Path Builder to discover the correct paths from your event payload, then paste them into the rule's event pattern. For example, filtering on $.detail.status ensures only events with a specific status field are routed to your target.
Kubernetes Admission Webhooks & CEL Policies
Kubernetes ValidatingAdmissionPolicies and OPA (Open Policy Agent) policies often need to reference specific fields in resource manifests. Click through the manifest JSON in the tree to generate the correct field paths, then reference them in your CEL expressions or Rego rules.
jq and JSONPath CLI Tools
When using jq on the command line to query large API responses, finding the right path can require trial and error. Paste the API response JSON here, click the value you want to extract, and use the generated path as the basis for your jq filter. The wildcard [*] syntax is directly supported for selecting all items in an array.
# From path $.store.books[*].author:
curl https://api.example.com/data | jq '.store.books[].author'
JSON Schema & API Documentation
When documenting API fields or writing JSON Schema $ref paths, the interactive explorer makes it easy to navigate deeply nested structures and confirm field names before writing them into documentation or validation schemas.
Frequently Asked Questions
Q: What is the difference between JSONPath and dot notation?
A: They are closely related. JSONPath always starts with $ (the root) and uses dot notation ($.a.b) or bracket notation ($['a']['b']) to navigate. The Path Builder generates the canonical dot notation format, which is the most widely supported form across tools and libraries.
Q: Why can I only click leaf values, not object or array nodes?
A: Paths to primitive values (strings, numbers, booleans, null) are unambiguous. Object and array nodes have multiple possible meanings — you might want the whole object or just one field. Clicking a leaf gives you the most precise, directly usable path. You can manually edit the path in the test box to point at a parent node if needed.
Q: Does the test expression evaluator support filter expressions like [?(@.price < 10)]?
A: The built-in tester supports dot notation, array index access ([0]), and wildcards ([*]). Advanced filter expressions using ?() predicates are not supported in the browser evaluator, but the path builder will still help you find the base path to use with a full JSONPath library in your code.
Q: How do I handle keys with special characters (spaces, hyphens)?
A: Keys with spaces or hyphens require bracket notation: $['my-key'] instead of $.my-key. The path builder uses dot notation by default. If your JSON contains such keys, switch to bracket notation in your actual query code.
Q: Can I use this tool to generate jq, Python, or JavaScript path syntax?
A: The generated JSONPath expressions are directly translatable. In Python with the jsonpath-ng library the syntax is identical. In JavaScript you can use jsonpath or jsonpath-plus npm packages with the same $. syntax. For jq, replace $. with . and remove brackets for simple paths.