json_hoist: Rectangle a JSON vector

Description Usage Arguments Value Examples

View source: R/json_hoist.R

Description

Rectangle a JSON vector

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
json_hoist(
  .data,
  .col,
  ...,
  .remove = TRUE,
  .ptype = list(),
  .wrap_scalars = list(),
  .default = list(),
  .na = list(),
  bigint_as_char = bigint_default()
)

Arguments

.data

A data frame.

.col

JSON-column.

...

Elements of .col to turn into columns in the form col_name = "JSON path".

.remove

If TRUE, the default, will remove the column .col.

.ptype, .wrap_scalars, .default, .na, bigint_as_char

Optionally, a named list of parameters passed to json_extract().

Value

A data frame, or subclass of data frame with new columns as specified in ....

Examples

1
2
3
4
5
6
7
8
df <- tibble::tibble(
  id = 1:5,
  json = json_flatten(got_chars_json)
)
json_hoist(df, json, url = "$.url", name = "$.name")

# the names can also be generated automatically
json_hoist(df, json, "$.url", "$.name")

jsontools documentation built on March 22, 2021, 5:06 p.m.