user313967 user313967 - 1 year ago 76
JSON Question

Importing data from a JSON file into R

Is there a way to import data from a JSON file into R? More specifically, the file is an array of JSON objects with string fields, objects, and arrays. The RJSON Package isn't very clear on how to deal with this

rcs rcs
Answer Source

First install the rjson package:



json_file <- ""
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

Update: since version 0.2.1

json_data <- fromJSON(file=json_file)