json_structure: Recursively structures arbitrary JSON data into a single data...

Description Usage Arguments Details Value See Also Examples

View source: R/json_structure.R

Description

Returns a tbl_json object where each row corresponds to a leaf in the JSON structure. The first row corresponds to the JSON document as a whole. If the document is a scalar value (JSON string, number, logical or null), then there will only be 1 row. If instead it is an object or an array, then subsequent rows will recursively correspond to the elements (and their children) of the object or array.

Usage

1

Arguments

.x

a json string or tbl_json object

Details

The columns in the tbl_json returend are defined as

Value

a tbl_json object

See Also

json_schema to create a schema for a JSON document or collection

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# A simple string
'"string"' %>% json_structure

# A simple object
'{"name": "value"}' %>% json_structure

# A complex array
'[{"a": 1}, [1, 2], "a", 1, true, null]' %>% json_structure

# A sample of structure rows from a company
library(dplyr)
companies[1] %>% json_structure %>% sample_n(5)

jeremystan/tidyjson documentation built on May 19, 2019, 5:09 a.m.