I am trying to parse json using jsonlite::fromJSON, and all sorts of crazy stuff comes back. This question shows one example where I give json in a file (blarg.json
), and examine the return value. To repeat:
blarg.json
file:
[{ "id": 211,
"sub_question_skus": { "0": 329, "behavior": 216 } },
{ "id": 333,
"sub_question_skus": [ 340, 341 ] },
{ "id": 345,
"sub_question_skus": [ 346, 352 ] },
{ "id": 444,
"sub_question_skus": null }]
Code:
library(jsonlite)
df <- fromJSON('blarg.json')
Data frame with embedded lists and vectors in the RStudio viewer:
How do I create this exact data frame from that question in simple R code, without using jsonlite? It would help me create test cases.
Bonus if it can create code from a data frame automatically (like "SHOW SELECT" in SQL).