如何在Javascript中解析以下JSON?

Apo*_*orv 1 javascript parsing json

我正在为诺基亚S40平台制作一个网络应用程序.我正在使用返回以下JSON的Javascript调用Web服务

{ "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" } ] } } 
Run Code Online (Sandbox Code Playgroud)

我想获得"short_url"和"long_url"值

我使用eval作为var obj = eval ("(" + xmlhttp.responseText + ")");

其中xmlhttp.responseText包含JSON响应.请帮忙

Vin*_*uis 9

试过这个并且工作了

 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);
Run Code Online (Sandbox Code Playgroud)