Transform json to a tidy dataframe Uses jsonlite::fromJSON together with some map, enframe and unnest_wider to create a tidy tibble/dataframe.

transform_json_to_dataframe(json, unnest_type = "long", keep_name = TRUE)

Arguments

json

json string

unnest_type

should the dataframe be wide or long?

keep_name

default: TRUE; tibble::enframe() names resulting cols, decide if name column is needed

Value

dataframe/tibble

Examples

if (FALSE) {
res <- httr::GET("https://lobid.org/gnd/search?q=preferredName:Max%20Spohr&format=json")
res <- httr::content(res, as = "text")
df_from_json <- transform_json_to_dataframe(res, unnest_type = "wide")
}