Home Ask Login Register

Developers Planet

Your answer is one click away!

user3006691 February 2016

JSON (using jsonlite) parsing error in R

I have the following JSON file:

{"id":1140851307,"name":"A Coruna"} 

I used the package jsonlite but I get a parsing error

try <- fromJSON("states.txt",simplifyDataFrame = T)
# Error in feed_push_parser(readBin(con, raw(), n), reset = TRUE) :   
# parse error: trailing garbage
#           :1140854908,"name":"'Amran"} {"id":1140852651,"name":"'Asir"
#                      (right here) ------^


vmachan February 2016

Try changing your data file to below

,{"id":1140851307,"name":"A Coruna"} 

The same code worked for me.. It is looking for an array..

Post Status

Asked in February 2016
Viewed 3,165 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life