JSON小问题,跪求指导[{i: img/1.jpg ,d:div dir\ltr\table border1trth字段1/th/
JSON小问题,跪求指导
[
{
"i": "img/1.jpg" ,
"d":"<div dir=\"ltr\"><table border="1"><tr><th>字段1</th></tr><tr><td>字段2</td></tr></table><br><br></div>",
"g": "116.387156,40.061626,0.000000",
"n": "郁闷求解答",
"p": "music.png"
}
]
问题如上,小弟想用直接读取JSON文件,生成一个表格形式的数据图表,反复实验都做不出来,求高手们指引一下我吧,谢谢啦~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[解决办法]
用jquery.parsejson吧
http://api.jquery.com/jQuery.parseJSON/
- JScript code
var obj = $.parseJSON(jsondata);//jsondata 为你上面一段的json代码$.each(obj, function(index,item) {if(item.i){ alert(item.i); //获取 img/1.jpg}}); 