JSONPath workflow
Find the right JSONPath expression before shipping it
A JSONPath expression that looks right can still match the wrong nodes. Test it against real data first.
Build the expression incrementally
Start broad, then narrow the path until only the intended nodes match.
Paste the target JSON
Use a payload with the same shape as production data.
Write a starting path
Begin from the root and add one segment at a time.
Check the matches
Confirm the count and content of every matched node.
Narrow with filters
Add conditions until only the intended values remain.
Paths that cover most queries
- $.users selects the users array
- $.users[0].name selects the first user name
- $..email finds every email at any depth
- $.users[?(@.active == true)] filters active users
Test before you ship
- 1
Open the JSONPath tester and paste the document.
- 2
Enter the expression and check the highlighted matches.
- 3
Compare the match count with your expectation.
- 4
Use the same expression in your code, knowing it was tested on real data.
Why paths match too much or too little
- A wildcard matches more nodes than expected
- Array indexes shift when data order changes
- A filter condition targets the wrong property
- Deeply nested arrays are easy to miscount
Write durable expressions
- Prefer named properties over positional indexes
- Test against more than one payload shape
- Keep filters explicit rather than overly broad
- Document the expression next to where it is used
Frequently asked questions
What is the difference between . and .. ?
A dot selects a direct child; the double dot searches recursively at any depth.
How do filters work?
Filters use [?(@.field == value)] and support comparisons, logical operators, and existence checks.
Can JSONPath select multiple matches?
Yes. Expressions such as $..email return every matching value as an array.
Is my JSON uploaded?
No. The tester runs locally in your browser.
Queries run against local data
The JSONPath tester evaluates expressions in the browser. Remove sensitive values from shared test payloads.
Open JSONPath Tester