1

I've got a well formated JSON string with a R script, but when I try to parse it using the rjson package (with parser$addData), I get this error :

>json <- fromJSON(docret)

>parser <- newJSONParser()
>parser$addData(json)

Erreur dans strsplit(buf, "") : 
  l'argument n'est pas une chaîne de caractères

My JSON string (docret here) is validated by two online JSON validators. Can I do something about this error to have my JSON object usable?

Here is my JSON : http://shrib.com/8dTgq90U

whisust
  • 176
  • 3
  • 16
  • I believe your variable `json` contains already parsed data (nested lists), hence there is no need to call `addData`. – Karsten W. Mar 06 '14 at 15:35
  • That was it, I didn't understood that it was either using json<-fromJSON(docret) or parser$addData(docret) and then parser$getObject(). Meanwhile using fromJSON seems really faster than the other way. Thanks for your answer! – whisust Mar 06 '14 at 15:46

0 Answers0