Description Usage Arguments Value See Also Examples
Flatten a JSON array
1 2 3 4 5 6 7 | json_flatten(
x,
ptype = NULL,
allow_scalars = FALSE,
wrap_scalars = FALSE,
bigint_as_char = bigint_default()
)
|
x |
A JSON vector. |
ptype |
Output type. If |
allow_scalars |
Do not error for scalar elements? |
wrap_scalars |
Should scalar values be wrapped? Note that scalars are only wrapped if either
|
bigint_as_char |
Convert big integers to character? The option
|
A flattened version of x
with class given by ptype
and length
equal to the sum of the json_array_length()
of the components of x
.
json_unnest_longer()
, json_unnest_wider()
1 2 3 4 5 6 7 8 9 | json_flatten(c("[1, 2]", "[3]"))
# names are kep
json_flatten(c(x = "[1, 2]", y = "[3]"))
# scalar elements produce an error ...
try(json_flatten(c(x = "[1, 2]", y = "3")))
# ... but can be explicitly allowed with `allow_scalars`
json_flatten(c(x = "[1, 2]", y = "3"), allow_scalars = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.