JSONPath query
Try it interactively →POST /api/jsonpathQuery a JSON document with a JSONPath expression (`$.users[*].name`). Supports filters, slices, recursive descent, and array indices.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| document* | string | — | The JSON document to query, as a string. |
| query* | string | — | The JSONPath expression (e.g. $.store.book[*].author). |
| resultMode | enum (values | paths | both) | "values" | What to return for each match. |
| maxResults | number (1…100000) | 10000 | Cap on the number of matches returned. |
Response
Modes: json. Cache: yes (24h TTL).
Code samples
Built from the store-authors example.
curl -X POST https://api.xtract.bot/api/jsonpath \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"document": "{\"store\":{\"book\":[{\"author\":\"Tolkien\"},{\"author\":\"Pratchett\"}],\"bicycle\":{\"color\":\"red\"}}}",
"query": "$.author",
"resultMode": "values",
"maxResults": 100
}'