VasylKorzhyk / as3corelib

Automatically exported from code.google.com/p/as3corelib
0 stars 0 forks source link

JSONParseError: Unexpected e encountered #146

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new Flex project
2. Decode this JSON file from Google: 
"http://www.google.com/finance/option_chain?q=MSFT&output=json"
3. You get an error of "JSONParseError: Unexpected e encountered"

This is what I see instead of the output being traced:

JSONParseError: Unexpected e encountered
    at com.adobe.serialization.json::JSONTokenizer/parseError()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONTokenizer.as:698]
    at com.adobe.serialization.json::JSONTokenizer/getNextToken()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONTokenizer.as:214]
    at com.adobe.serialization.json::JSONDecoder/nextToken()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:102]
    at com.adobe.serialization.json::JSONDecoder/parseObject()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:195]
    at com.adobe.serialization.json::JSONDecoder/parseValue()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:297]
    at com.adobe.serialization.json::JSONDecoder/parseArray()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:147]
    at com.adobe.serialization.json::JSONDecoder/parseValue()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:300]
    at com.adobe.serialization.json::JSONDecoder()[/Users/ccantrel/Projects/google/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:72]
    at WPAOSDesktop/onLoad()[C:\...\src\Test.mxml:26]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

Original issue reported on code.google.com by e...@uclient.net on 27 Jul 2011 at 2:42

GoogleCodeExporter commented 8 years ago
This is solved already. I didn't expect that a Google API would provide an 
invalid format of a JSON file. It does not put double quotes on its element 
names... just the values of it. Doing a little RegExp before JSON decoding 
helps solved the problem.

Original comment by red.bie...@gmail.com on 27 Jul 2011 at 3:40