JSON Path Examples
Use JSON path examples to name nested fields, array items, and response values before sharing a formatter, validator, or API note.
Name the value before debugging it
A path such as user.profile.email or items[0].price makes it easier to discuss one nested value without pasting the whole JSON sample again.
- Use object keys in order from root to value.
- Use array indexes when a value belongs to a list item.
- Keep the original sample nearby when documenting paths.
Check arrays and optional fields carefully
Paths can change when an API returns an empty array, a nullable object, or a different response shape for an error state.
- Confirm whether the path exists in success and error responses.
- Do not assume every array item has the same nested fields.
- Use the formatter first when minified JSON makes structure hard to scan.
Reference Blocks
Use these short blocks as starting notes before opening the calculator.
Path note
Root object: order Customer email: customer.email First item SKU: items[0].sku First item price: items[0].price Error message: error.message
Review table
Shape | Path style Object field | user.name Array item | items[0] Nested array field | orders[0].lines[0].sku Optional value | billing.address?.postalCode in code notes
Worked Examples
Customer field
An order response has customer.email inside the root object.
Document the path as customer.email.
Do not call it email if another email field exists elsewhere.
First array item
The first line item has a SKU inside items.
Use items[0].sku for the first item SKU.
Indexes are zero-based in most developer notation.
Error response
A failed response returns error.message instead of data.items.
Document both success and error paths.
A path that exists only on success can fail in error handling.
Common Mistakes
- Documenting a field name without its parent object path.
- Using one array item as proof that every item has the same fields.
- Ignoring error-response shape when debugging an endpoint.
When This Is Not Enough
- Path notation can differ by library, query language, or codebase convention.
- This guide does not validate schemas or required fields.
- Redact customer values, tokens, and private IDs before sharing JSON examples.