rjsonpath.RdThe **rjsonpath** package provides an implementation of the JSONPath query language for R. JSONPath is an XPath-like syntax for selecting elements from JSON data structures.
The main entry point is [json_path()], which evaluates a JSONPath expression against a JSON object read with [read_json()]. It supports common JSONPath features, including:
- **Property access** via `$.prop` and nested properties - **Array indices and slices** such as `$.items[0]`, `$.items[1:3]` - **Wildcards** (`*`) for properties and array elements - **Recursive descent** using `..` - **Filters** with `?()` expressions, e.g. `?(@.price < 10)` - **Length‑based expressions** like `(@.length-1)`
Typical usage is:
1. Read JSON from a file or connection with [read_json()]. 2. Apply a JSONPath query with [json_path()] to select elements. 3. Optionally set `simplify = TRUE` to coerce simple list results to atomic vectors.
By default, [json_path()] requires paths to start with `"$"` and treats numeric indices as zero-based (JSON-style). You can relax these behaviours using the `strict` and `zero_index` arguments.
[json_path()] for evaluating JSONPath expressions.
[read_json()] for reading JSON data into R.
The original JSONPath description at http://goessner.net/articles/JsonPath/.