Learn R Programming

jsontools (version 0.1.0)

json_hoist: Rectangle a JSON vector

Description

Rectangle a JSON vector

Usage

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

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab