Hi.
I am developing a new application that accepts JSON string from the server using Twisted framework. I am using Eclipse as IDE with Aptana and WRT plugin.
When I'm testing the application using the emulator and Firefox, the app can parse the JSON perfectly. But when I try it on the device, specifically N78 and N96, the JSON parser returns a SyntaxError on JSON.parse. I have already used json2.js, json.js, json_parse.js and their previous versions to no avail.
Note that when I ran this code using Opera Widget, it is working perfectly just like the emulator. My guess is that there is some conflict between Twisted, WRT, and the browser.
This is where the error occurs on javascript:
The following code is how python serializes a JSON object to a JSON formatted string:Code:var respObj = JSON.parse(xmlhttp.responseText);
Here is a sample JSON I'm passing to WRT from Twisted:Code:self.request.write(simplejson.dumps(self.reply)) self.request.finish()
*actual JSON format sent to WRT:
*the following has been indented by 5 spaces for readabilityCode:{"Login-Response": {"SessionID": "8q7l8auzi0", "Contacts": {"All Contacts": {"wv:hello.world@gmail.com": {"OnlineStatus": "F"}}, "NEW LIST": {"wv:hello@gmail.com": {}}, "My Friends": {}}}}
Is there anything I am doing wrong? If you need more info, I'll gladly provide it.Code:{ "Login-Response": { "SessionID": "8q7l8auzi0", "Contacts": { "All Contacts": { "wv:hello.world@gmail.com": { "OnlineStatus": "F" } }, "NEW LIST": { "wv:hello@gmail.com": {} }, "My Friends": {} } } }
Thanks,
Aceley

Reply With Quote


