It's there a way to convert json to data frame in r

I have a json list. Which can go down to n number of nodes and I have no control over size and number of records. But I want to convert that into a data table how should I do it. Without sacrificing speed because it's a part of a shiny application.

There's no generic way to tidy all JSON, since the structures vary so much. If it's relatively simple, this solution might work for you (it uses data.table::rbindlist())

More complex, check out jsonlite,

Vignette here: https://cran.r-project.org/web/packages/jsonlite/vignettes/json-aaquickstart.html

Also roomba, which has some helpers for common response tidying…

Many articles/tutorials out there use purrr (super helpful for nested JSON), and, if you need that, and want to up the speed, you can implement furrr alternatives, too (example from when Alex Bresler made this switch for nbastatR, which parses tons of JSON)

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.