appcelerator titanium cannot parse JSON

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2011-02-24T07:21:04Z Indexed on 2011/02/24 7:25 UTC
Read the original article Hit count: 321

Filed under:
|
|

Hi,

I'm new to titanium and get difficulty in parsing JSON from mysql export. the json is valid and I feel frustrated with many unsuccessful trials. To simplify the code, I put it below. The code just stop and said: [ERROR] Script Error = Unable to parse JSON string

var win = Titanium.UI.currentWindow;


var hotdealjson = "{'hotdeal':[{'place':'bangkok','date':'4D3N','cost':'$4999up'},{'place':'tokyo','date':'3D2N','cost':'$3799up'}]}";


//read json
var response = JSON.parse(hotdealjson);
alert(response.hotdeal.length);

Thanks & regards, Richard

© Stack Overflow or respective owner

Related posts about JSON

Related posts about titanium