Description Usage Arguments Value Note See Also Examples
Access to the value of a JSON string by giving a sequence of keys.
1 | jsonAccess(json, path, toJSON = FALSE, fromJSON = FALSE)
|
json |
a JSON string |
path |
character vector, sequence of keys |
toJSON |
logical, whether to apply |
fromJSON |
logical, whether to apply |
A json string if fromJSON=FALSE
, a R object if fromJSON=TRUE
.
Instaed of using the option toJSON=TRUE
, you can apply
toJSON
before; this allows you to apply it
with its options. Same remark for the option toJSON=FALSE
.
1 2 3 4 5 6 7 8 9 | json <- "{\"a\":{\"b\":8,\"c\":[1,2]},\"b\":null}"
jsonAccess(json, "a")
jsonAccess(json, "b")
jsonAccess(json, "X")
jsonAccess(json, c("a","c"))
# get the result as a R object:
jsonAccess(json, c("a","c"), fromJSON=TRUE)
# same as:
jsonAccess(json, c("a","c")) %>% jsonlite::fromJSON(.)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.