as3corelib icon indicating copy to clipboard operation
as3corelib copied to clipboard

JSONParseError: Unexpected o encountered

Open darronschall opened this issue 15 years ago • 8 comments

Originally filed by varun.1984 on 2009-09-02T18:05:14

What steps will reproduce the problem? 1. 2. 3.

What is the expected output? What do you see instead? bug free

What version of the product are you using? On what operating system? latest,windows

Please provide any additional information below.

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by darron.schall on 2009-09-03T14:11:25

Please attach the JSON string you are trying to decode so we can identify the potential issue. You might also want to try making sure the JSON string is valid by running it through the online validator at: http://www.jsonlint.com/

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by darron.schall on 2009-09-03T14:11:35

Original ticket set status to NeedMoreInfo (we converted to open)

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by mopics25 on 2009-11-20T12:53:09

here's some code that gives this Error :

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by scitronpousty on 2010-01-07T21:56:45

I checked my JSON on jsonlint and it validates and I also get the unexpected o issue. I searched for a word beginning with o that was not escaped properly and cannot find it.

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by scitronpousty on 2010-01-07T22:02:31

Parsing works though if I use this construct instead:

var decoder:JSONDecoder = new JSONDecoder(resultString); var resultObject:Object = (decoder.getValue() as Object); var features:Array = new Array(resultObject["features"]);

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by rahul.schaudhary on 2010-02-09T11:59:20

I have also fallen into same situation. The only difference is that I am getting- Unexpected j error.

I also have validated my JSON string using the tool provided. Do we have some solution to it?

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by ugommirikwe on 2010-04-13T12:34:51

I had the same issue too, but I discovered the problem was that I didn't indicate in the "resultFormat" property of the HTTPService object as "text". I change this property to text and that error went away. Infact you don't have to use the method suggested by scitronpousty; just write your code the normal way: JSON.decode (e.result.toString())..

Hope this helps someone.

darronschall avatar Jul 28 '10 20:07 darronschall

Updated by Benjamin.Lowenstein on 2010-07-09T22:01:36

The workaround in #5 worked well for me for this exact error.

import com.adobe.serialization.json.JSONDecoder;

var decoder:JSONDecoder = new JSONDecoder(myJSONstring); var myJSONobj:Object = (decoder.getValue() as Object);

darronschall avatar Jul 28 '10 20:07 darronschall