flattenj {mojson} | R Documentation |
JSON Flatten
Description
Transform multiple JSON objects into a flattened data frame.
Usage
flattenj(dat, sep = "@", compact = TRUE)
Arguments
dat |
|
sep |
|
compact |
logical. Whether to generate the compact or completely expanded data frame. Defaults to |
Details
The function flattens multiple JSON objects into a new data frame. The result contains multiple columns.
If compact=TRUE
, it returns paths
, values
and index
columns, otherwise level1
, level2
, ..., values
and index
.
The index
column stores the id of each JSON object.
Value
data frame
. The flattened result.
See Also
Examples
library(mojson)
j <- list(a = list(x = 1, y = 2),
b = c(3, 4, list(z = 5, s = 6, t = list(m = 7, n = 8))))
j_multi <- list(j, j, j)
flattenj(j_multi)
flattenj(j_multi, compact=FALSE)