Query JSON/CSV File
json_queryExtract a slice of a local JSON or CSV file using a path query, avoiding the need to load the entire file. Returns only the matching data as JSON.
Instructions
Extract a slice of a local JSON or CSV file with a path query, instead of reading the whole file into context. CSV files are parsed using the first row as headers (every row becomes an object).
Path syntax: "." is the whole document, ".key.subkey" descends into objects, "[0]" indexes an array, "[]" maps over every element. Examples: ".users[0].name", ".items[].price", ".results[]" .
Args:
path (string): The .json or .csv file.
query (string): Path query (default "." — but prefer something narrower).
limit (number): If the result is an array, max elements returned (default 100).
Returns the matching slice as JSON.
Example: { "path": "~/data/users.json", "query": ".users[].email" }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | JSON or CSV file path | |
| query | No | Path query, e.g. ".users[].name" | . |
| limit | No | Max array elements returned |