json数据
{sum:2600,nn:'老马',list:[{tradName:'晶澳太阳能',volume:'2012-03-08',dealPre:'12.00',changeRate:'0.49%',UpDownRate:'40%']}
如何通过js获取nn 或者 sum的值呢...
------解决方案--------------------
var o = {
sum: 2600,
nn: '老马',
list: [{
tradName: '晶澳太阳能',
volume: '2012-03-08',
dealPre: '12.00',
changeRate: '0.49%',
UpDownRate: '40%'
}]
};
alert(o.nn)
alert(o.sum)
------解决方案--------------------
- JScript code
var json = {sum:2600,nn:'老马',list:[{tradName:'晶澳太阳能',volume:'2012-03-08',dealPre:'12.00',changeRate:'0.49%',UpDownRate:'40%'[color=#FF0000]}[/color]]}; alert(json.sum); alert(json.list[0].tradName);