To parse a JSON file with jsonlite
package in R
, you can use the fromJSON()
function.
Here is an example:
main.r253 chars11 lines
In this example, system.file()
function is used to get the path of a sample JSON file. You can replace this with the path of your JSON file.
fromJSON()
function will read the JSON file and convert it into a list or a data frame depending upon the content of the JSON file.
You can access the elements of the resulting list or data frame using regular R syntax.
gistlibby LogSnag