json_query
Query JSON from a URL or raw input using JSONPath-lite expressions to extract specific data, reducing token usage by loading only needed values.
Instructions
Fetch JSON from a URL (or accept raw JSON) and query it with a JSONPath-lite expression. Supports property access, array indexing, wildcards ([*]), recursive descent (..), and filter expressions ([?(@.price < 10)]). Provide exactly one of url or json — not both. Returns only the matching values as JSON. Returns an error if the URL is unreachable, the response is not valid JSON, or the query expression is invalid. Has no side effects. Use instead of loading large JSON payloads into your context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL returning JSON to query (http/https). | |
| json | No | Raw JSON string to query (alternative to url). | |
| limit | No | Max number of results to return (default 100, max 1000). | |
| query | Yes | JSONPath-lite expression. Examples: '$.users[*].name', '$..price', '$.items[?(@.stock > 0)].id', '$.store.books[0].title' |