How to parse The following JSON in Javascript? -


i making web app nokia s40 platform . calling web service using javascript returns following json

{ "status_code": 200, "status_txt": "ok", "data": { "expand": [ { "short_url": "http:\/\/bit.ly\/msapps", "long_url": "http:\/\/www.microsoft.com\/web\/gallery\/?wt.mc_id=soc-in-wag-msp-m389", "user_hash": "gbl9jv", "global_hash": "ehgpgh" } ] } }  

i want obtain "short_url" , "long_url " values

i using eval var obj = eval ("(" + xmlhttp.responsetext + ")");

where xmlhttp.responsetext conatains json response. please

tried , worked

 var s = '{ "status_code": 200, "status_txt": "ok", "data": { "expand": [ { "short_url": "http://bit.ly/msapps", "long_url": "http://www.microsoft.com/web/gallery/?wt.mc_id=soc-in-wag-msp-m389", "user_hash": "gbl9jv", "global_hash": "ehgpgh" } ] } } '   var d = json.parse(s);  console.log(d.data.expand[0].short_url);  console.log(d.data.expand[0].long_url); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -