1

I used rjson and do this JSON <- lapply(data$toParse, fromJSON)

my toParse has 600k rows of simple/short JSON.

However, it is very slow possibly because fromJSON doesn't vectorize operation so I have to use lapply.

I am wondering if there is any better way for parsing a list of JSON?

2
  • If nothing has changed for the last few months rjson is the only one json parser available for R. Alternative solution could be parsing json some external tools and preprocessing your data. There is pretty extensive list of available libraries on json.org Commented Sep 10, 2013 at 18:04
  • @zero323 there is also RJSONIO. Commented Sep 10, 2013 at 19:07

1 Answer 1

1

What about pasting the text into an array and parsing, rjson::fromJSON(sprintf("[%s]", paste(data$toParse, collapse=",")))?

Sign up to request clarification or add additional context in comments.

2 Comments

I had come up similar idea, but didn't think it would work out much improvement. However, the benchmark shows 30% faster
so in my case sprintf + paste is faster than lapply + Fun via Rprof

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.