keys {jqr} | R Documentation |
keys
takes no input, and retrieves keys. del
deletes
provided keys. haskey
checks if a json string has a key, or the
input array has an element at the given index.
keys(.data) del(.data, ...) del_(.data, ..., .dots) haskey(.data, ...) haskey_(.data, ..., .dots)
.data |
input. This can be JSON input, or an object of class
|
... |
Comma separated list of unquoted variable names |
.dots |
Used to work around non-standard evaluation |
dots |
dots |
# get keys str <- '{"foo": 5, "bar": 7}' jq(str, "keys") str %>% keys() # delete by key name jq(str, "del(.bar)") str %>% del(bar) # check for key existence str3 <- '[[0,1], ["a","b","c"]]' jq(str3, "map(has(2))") str3 %>% haskey(2) jq(str3, "map(has(1,2))") str3 %>% haskey(1,2) ## many JSON inputs '{"foo": 5, "bar": 7} {"hello": 5, "world": 7}' %>% keys '{"foo": 5, "bar": 7} {"hello": 5, "bar": 7}' %>% del(bar)