FormatForge logoFormatForge

Developer guide

JSONPath Examples Cheat Sheet: Objects, Arrays, Wildcards and Filters

Use practical JSONPath examples to query root properties, nested objects, arrays, wildcards, recursive fields and filters in JSON data.

By FormatForge2026-06-239 min read

Quick summary

Use practical JSONPath examples to query root properties, nested objects, arrays, wildcards, recursive fields and filters in JSON data. This guide gives you a clear, practical explanation before you use the related online tool.

1

JSONPath mental model

JSONPath is a query notation for selecting values from JSON. Most expressions start at the root with $, then navigate properties and arrays. Exact syntax support can vary between implementations, especially for filters and advanced operators, so test expressions in the environment where they will run.

2

Root and nested properties

Use $.name for a property on the root object. For nested data such as {"customer":{"email":"a@example.com"}}, $.customer.email selects the email. Bracket notation can be useful for property names that contain spaces or characters that do not fit simple dot notation.

3

Array indexes and slices

For a users array, $.users[0] selects the first element and $.users[*] selects every element. $.users[*].email projects the email property from each user. Some implementations also support slices such as [0:2], but portability should be verified.

4

Wildcards and recursive descent

The wildcard * selects all matching children at a level. Recursive descent, commonly written $..id, searches through nested structures for fields named id. Recursive queries are convenient for exploration but can return more matches than expected in large or heterogeneous payloads.

5

Filter examples

Many JSONPath implementations support filters such as $.products[?(@.price < 100)] to select products below a price threshold. String comparisons, logical operators and exact filter grammar vary across libraries, so avoid assuming an expression tested in one engine is portable to every platform.

6

API-response example

For an API response containing orders, $.orders[*].orderId can extract all order IDs. To inspect the first order’s line items, use a path such as $.orders[0].items[*].sku. Build the path incrementally when working with unfamiliar payloads.

7

Debugging a JSONPath that returns nothing

First validate and format the JSON. Then confirm whether the root is an object or array, check property spelling and case, and test one segment at a time. If a filter fails, verify that the implementation supports that filter syntax and that compared values have the expected types.

8

Practical workflow

Paste representative JSON into JSONPath Explorer, start with $, expand to the target branch, then add array selection or filters. Confirm both the number of matches and their values before moving an expression into an automated test, ETL step or production script.

Continue with a free tool

Related FormatForge tools

Explore the complete workflow

Continue from this guide to the broader category or curated collection to find related tools and supporting workflows.

Frequently asked questions

What does $ mean in JSONPath?

It normally represents the root of the JSON document.

How do I select every item in an array?

A common expression is $.items[*], where * selects all array elements.

What does $..id do?

In implementations supporting recursive descent, it searches nested content for fields named id.

Why does a JSONPath filter work in one tool but not another?

Advanced JSONPath syntax is not perfectly uniform across implementations, so filter and operator support can differ.

How should I debug JSONPath?

Validate the JSON, confirm object and array structure, then build the expression one segment at a time and inspect the matches.

Keep learning

Related guides