Demo: extract user emails from a nested API response
A practical JSONPath review starts with a payload that looks like production but removes sensitive values. The tester should show both the matched values and the path shape so you can turn the expression into a test assertion.
- Use $..email when email fields can appear at different depths.
- Use $.users[*].email when the schema is stable and you want stricter matching.
- Prefer strict paths for tests and recursive paths for exploration.
$.users[*].email
{
"users": [
{"id": 1, "email": "ada@example.com"},
{"id": 2, "email": "grace@example.com"}
]
}The first line is the expression; the rest is the JSON payload to inspect.