I have a tibble with JSON column that looks like:
df <- tibble(
id = c(1, 2),
json_col = c('{"a": [1,2,3], "b": [4, 5, 6]}', '{"f": [100,2,8]}')
)
I would like to get long format tibble that looks like:
id | key | val
----------------
1 | "a" | c(1,2,3)
1 | "b" | c(4,5,6)
2 | "f" | c(100,2,8)
There is a huge number of different JSON keys in different rows. Also, ids can have a different number of json keys.
I would like to do it using tidyverse
stack.