Json to R dataframe data extraction error



I am trying to convert a json file to a dataframe in R. I used the package ‘jsonlite’ for the purpose and I obtained the following error can some explain why this is happening? And how to solve it?

> X<-readLines('meta_Beauty.json')
> y<-fromJSON(X)
Error in parse_string(txt, bigint_as_char) : 
parse error: trailing garbage
      ing Ultra-Hydrating Serum)"} {"asin": "0558925278", "salesRa
   (right here) ------^

Thanks in advance.


try pasting a bit of your dataset here- this is clearly something to do with your data

One solution could be ( since we dont know your data format)

The latest version of the jsonlite package supports streaming JSON (which is what this actually is). You can now read it with one line like so:

json_file <- stream_in(file(“usagov_bitly_data2013-05-17-1368832207”))