jq: Execute a query with jq

Description Usage Arguments See Also Examples

View source: R/jqr.R

Description

jq is meant to work with the high level interface in this package. jq also provides access to the low level interface in which you can use jq query strings just as you would on the command line. Output gets class of json, and pretty prints to the console for easier viewing. jqr doesn't do pretty printing.

Usage

1
2
3
4
5
6
7
jq(x, ...)

## S3 method for class 'jqr'
jq(x, ...)

## S3 method for class 'character'
jq(x, ..., flags = jq_flags())

Arguments

x

json object or character string with json data. this can be one or more valid json objects

...

character specification of jq query. Each element in code... will be combined with " | ", which is convenient for long queries.

flags

See jq_flags

See Also

peek

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
'{"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("[123, 456] [77, 88, 99]", ".[]")

jqr documentation built on Sept. 28, 2017, 5:03 p.m.

Related to jq in jqr...