Takes a JSON object as loaded via the read_json function and applies a JSONPath query.

json_path(json, path, strict = TRUE, zero_index = TRUE, simplify = TRUE)

Arguments

json

a JSON object loaded by read_json

path

a JSONPath expression string, see details

strict

require JSONPath starts with '$.'

zero_index

numeric indices start from 0 rather than 1

simplify

convert simple list results to vectors

Value

a list or vector of JSONPath results

Details

JSONPath is an XPath-like language for querying JSON data, see http://goessner.net/articles/JsonPath/ for details.

Examples

if (FALSE) { # \dontrun{
json <- read_json("bookstore.json")
authors <- json_path(json, "$.store.books[*].author")
# [1] "Nigel Rees"       "Evelyn Waugh"     "Herman Melville"  "J. R. R. Tolkien"
} # }