1

I have an array of JSON objects as a string that I would like to load into R as a data.frame. IN particular, assume I have the following JSON,

[
  { "a": 1, "b": "c" },
  { "a": 1, "b": "d" }
]

What I want is a data.frame whose columns are all unique keys of all objects in the above, and 1 row per entry in the array, like so,

  a  b
1 1 "c"
2 1 "d"

This behavior is identical to pandas.DataFrame.from_records in Python. Does such a method exist?

duckworthd
  • 14,679
  • 16
  • 53
  • 68
  • `rjson` and `RJSONIO` seem to convert JSON objects to lists. I'm not sure how to go the extra mile to convert them into `data.frame`s. – duckworthd Aug 23 '13 at 23:38
  • `as.data.frame` probably, though be aware that data frames are required to have columns of equal length. – joran Aug 24 '13 at 00:45

0 Answers0