0

New to this so please excuse any mistakes.

I am using R to convert some JSON files and using JSONLITE is perfect in relation to the format that it produces. However I keep getting a lexical error similar to the below

Error in parse_con(txt, bigint_as_char) : lexical error: invalid char in json text. ed that it was delivered to "letterbox" but it wasn't\" ]\n (right here) ------^

So I decided to use the JSONIO package and there is no lexical error with this package but the format is not as easy to work with.

So suppose I have two questions:

1: Does any one know why the error is produced using Jsonlite and not jsonio 2; is there an easy way to get jsonio to produce outputs like jsonlite?

Thanks

Ibrahim

  • 1
    Please provide a small sample of the json you're using. Without it, it's just (not fun) guess work. – Roman Luštrik Jul 12 '18 at 08:32
  • {\n \"id\" : \"JHR7482Q005\",\n \"name\" : \"What information were you looking for that you could not find?\",\n \"phrase\" : \"What information were you looking for that you could not find?\",\n \"type\" : \"CQ\",\n \"label\" : \"OE_Visit Web First - Info\",\n \"responseType\" : \"TEXT_FIELD\",\n \"answers\" : [ \"Telephone number to actually speak to someone as I had received an email and text saying the parcel had been delivered to my letterbox when in fact it hadn't\" ]\n } – IbrahimAhmed Jul 12 '18 at 10:07
  • Hi Roman added json above,below is the code from the json file im loading :{\n \"id\" : \"JHR7482Q005\",\n \"name\" : \"What information were you looking for that you could not find?\",\n \"phrase\" : \"What information were you looking for that you could not find?\",\n \"type\" : \"CQ\",\n \"label\" : \"OE_Visit Web First - Info\",\n \"responseType\" : \"TEXT_FIELD\",\n \"answers\" : [ \"Telephone number to actually speak to someone as I had received an email and text saying the parcel had been "delivered" to my letterbox when in fact it hadn't\" ]\n } – IbrahimAhmed Jul 12 '18 at 10:08
  • I know that that quotes haven't been escaped properly but whats puzzeling me is how come jsonio can deal with it but jsonlite cant – IbrahimAhmed Jul 12 '18 at 10:13
  • Please add the JSON by editing your question. – Roman Luštrik Jul 12 '18 at 13:40

0 Answers0