[R] JSONlite import problem

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Sun Oct 25 00:27:44 CEST 2015


On Sat, Oct 24, 2015 at 1:35 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
>
> > However, editing the file with a text editor to create "proper" EOF
> > doesn't help.
>
> The problem is that you have valid-looking JSON objects on each odd
> numbered line, separated by single blank lines.  The parser expects an
> EOF at the end of the first object, but instead it found a blank line
> and another object.


Actually this is a common json streaming format called ndjson a.k.a.
jsonlines. Usually you can stream-import the data directly in jsonlite
using the stream_in function. See ?stream_in for examples.

However in this case there are white lines in between the json lines
which makes it a bit more tricky. I will add a feature to skip over
those lines.



More information about the R-help mailing list