JSON object returned is malformed.. so says the machine..
I get malformed JSON object returned.. can someone else have a gander
The JSON object returned for this topic: http://realapi.getsatisfaction.com/to... borks in Flex/AIR. I get:
[RPC Fault faultString="Error #1090: XML parser failure: element is malformed." faultCode="Client.CouldNotDecode" faultDetail="null"]
I have had no problem pulling in other feeds..
The JSON object returned for this topic: http://realapi.getsatisfaction.com/to... borks in Flex/AIR. I get:
[RPC Fault faultString="Error #1090: XML parser failure: element is malformed." faultCode="Client.CouldNotDecode" faultDetail="null"]
I have had no problem pulling in other feeds..
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?looking into this presently...
-
Inappropriate?I'm on it, looks like rails default to_json isn't properly escaping the content in some places.
Expect a fix by tomorrow at the latest. I'll post again here when it has been deployed -
Inappropriate?Fixed!
-
Inappropriate?hmmm I am still getting an actionscript parsing error on the return
I’m in need of coffee
-
Inappropriate?Can you provide an ActionScript snippet that fails so I can test?
For the record, I've confirmed that it parses under Ruby (using the latest json gem) under python (using simplejson 1.8.1) and in javascript in both safari and firefox.
Does ActionScript not like unicode characters in it's json? -
Inappropriate?Thanks, Scott. not sure about the unicode, but I'll look into that.
code:
(in case it doesn't show up: http://pastebin.com/m21b4f1f6)
private function getSingleTopic():void
{
var http:HTTPService = new HTTPService();
http.addEventListener(ResultEvent.RESULT,singlepost);
http.addEventListener(FaultEvent.FAULT,getSatisfaction_Fail);
http.resultFormat = "object";
http.method = "get";
http.headers = {Accept:"text/x-json"};
http.cancel();
http.url = "http://realapi.getsatisfaction.com/topics/188921";
http.send();
}
private function singlepost(evt:ResultEvent):void
{
trace(evt.result);
Alert.show("We have got it!");
}
private function getSatisfaction_Fail(evt:FaultEvent):void
{
trace(evt.fault.toString());
}
-
Inappropriate?Critter,
Looking at the Flex 3 docs, the HTTPService doesn't have support built in for JSON. See http://livedocs.adobe.com/flex/3/lang... which refers to the resultFormat. When resultFormat == "object" it expects a tree of ActionScript objects serialized as XML.
This would explain why you are getting "Error #1090: XML parser failure: element is malformed." as an error string. With a quick browsing of Google, some are recommending that you use AS3CoreLib (http://code.google.com/p/as3corelib/) to decode json.
I’m hoping that helps
1 person says
this answers the question
-
Inappropriate?hmm I am using the as3corelib for my JSON conversion..
aye.. just after I pasted that I noticed I had it set to 'object' as opposed to 'text'
switching it to text sorted the problem... sorry for all the trouble.. pfft
I’m apprently in need of many much more coffees
-
Inappropriate?No trouble at all Critter!
You did in fact catch a bug yesterday with the unicode data, so I'm grateful for that.
I’m raising a cheers with a hot cup of joe
Loading Profile...



EMPLOYEE