'{"a": 7}' %>% do(.a + 1)
'[8,3,null,6]' %>% sortj
x <- '[{"message": "hello", "name": "jenn"},
{"message": "world", "name": "beth"}]'
jq(index(x))
jq('{"a": 7, "b": 4}', 'keys')
jq('[8,3,null,6]', 'sort')
# many json inputs
jq(c("[123, 456]", "[77, 88, 99]", "[41]"), ".[]")
# Stream from connection
tmp <- tempfile()
writeLines(c("[123, 456]", "[77, 88, 99]", "[41]"), tmp)
jq(file(tmp), ".[]")
if (FALSE) {
# from a url
x <- 'http://jeroen.github.io/data/diamonds.json'
jq(url(x), ".[]")
# from a file
file <- file.path(tempdir(), "diamonds_nd.json")
download.file(x, destfile = file)
jq(file(file), ".carat")
jq(file(file), "select(.carat > 1.5)")
jq(file(file), 'select(.carat > 4 and .cut == "Fair")')
}
Run the code above in your browser using DataLab