Types and related functions
Examples
# get type information for each element
jq('[0, false, [], {}, null, "hello"]', 'map(type)')
#> [
#> "number",
#> "boolean",
#> "array",
#> "object",
#> "null",
#> "string"
#> ]
'[0, false, [], {}, null, "hello"]' %>% types
#> [
#> "number",
#> "boolean",
#> "array",
#> "object",
#> "null",
#> "string"
#> ]
'[0, false, [], {}, null, "hello", true, [1,2,3]]' %>% types
#> [
#> "number",
#> "boolean",
#> "array",
#> "object",
#> "null",
#> "string",
#> "boolean",
#> "array"
#> ]
# select elements by type
jq('[0, false, [], {}, null, "hello"]', '.[] | numbers,booleans')
#> [
#> 0,
#> false
#> ]
'[0, false, [], {}, null, "hello"]' %>% index() %>% type(booleans)
#> false