1. Defining an Array in JSON
Consider a JSON document representing a set of users:users is an array of objects. Each object has id, name, and age properties.
2. Accessing Array Elements
2.1 By Index
Pick a single element by its zero-based index:2.2 Using Wildcard
Retrieve all users with the wildcard*:
2.3 Slicing the Array
Extract a range of elements with slice notation[start:end]:
start or end:
[:2]→ first two elements[2:]→ from the third element onward
JSONPath uses zero-based indices. Negative indices or step values (e.g.,
[::2]) are not supported in all implementations.3. Filtering Array Elements
Apply a filter expression to select items matching a condition:3.1 Accessing Properties of Filtered Results
Chain selectors to extract specific fields:4. Nested Arrays
Given nested arrays, you can flatten or traverse them:5. Summary of JSONPath List Operators
By mastering these operators, you can query, transform, and navigate JSON arrays with precision.