| Title: | Fast 'JMESPath' Queries for R Objects and JSON |
|---|---|
| Description: | Evaluate 'JMESPath' expressions against R lists, data frames and JSON strings. Built on the Rust 'jmespath' crate through 'extendr', with compiled expressions that can be reused across queries. |
| Authors: | First Last [aut, cre] |
| Maintainer: | First Last <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1 |
| Built: | 2026-10-09 17:07:19 UTC |
| Source: | https://github.com/DyfanJones/fastjmespath |
jmespath_search() evaluates a JMESPath expression
against an R object, and jmespath_search_json() against a JSON string.
Use jmespath_compile() to parse an expression once and reuse it.
jmespath_search(data, expression, simplify = TRUE) jmespath_search_json(data, expression, simplify = TRUE) jmespath_compile(expression)jmespath_search(data, expression, simplify = TRUE) jmespath_search_json(data, expression, simplify = TRUE) jmespath_compile(expression)
data |
An R object ( |
expression |
A JMESPath expression string, or an object returned by
|
simplify |
Whether to simplify arrays of scalars to atomic vectors. |
The query result as an R object.
Length-1 atomic vectors become scalars, longer ones arrays. Wrap a
single value in list() to force an array.
Named lists become objects, unnamed lists arrays.
Data frames become arrays of row objects.
Factors become strings.
NULL, NA, NaN and Inf become null.
Objects become named lists. Keys come back in alphabetical order.
With simplify = TRUE, arrays of scalars of one type become atomic
vectors (null becomes NA). Otherwise arrays are lists.
Integers outside the 32-bit range are returned as doubles.
Failures signal conditions of class jmespath_error, with subclasses
jmespath_syntax_error (bad expression), jmespath_search_error
(evaluation failed, e.g. a type error) and jmespath_json_error
(data is not valid JSON).
people <- list(people = list( list(name = "a", age = 20L), list(name = "b", age = 30L) )) jmespath_search(people, "people[?age > `25`].name") expr <- jmespath_compile("people[*].age") jmespath_search(people, expr) jmespath_search_json('{"a": {"b": 1}}', "a.b")people <- list(people = list( list(name = "a", age = 20L), list(name = "b", age = 30L) )) jmespath_search(people, "people[?age > `25`].name") expr <- jmespath_compile("people[*].age") jmespath_search(people, expr) jmespath_search_json('{"a": {"b": 1}}', "a.b")