我如何在JSON数据下面解析这个数据作为我从服务器返回的数据,我想从这个json数据中提取值和标签,并且必须放在一个弹出窗口中.
例如: - 对于此数据 "application_number":"20007524.8"
我想提取application_number作为应用程序编号,并对应于应用程序编号,其值为20007524.8
有什么建议我怎么能这样做..
jsonp13082({"responseHeader":{"status":0,"Time":3,"params":{"json.wrf":"jsonp13082","wt":"json","q":"8377"}},"response":{"numFound":1,"start":0,"docs":[{"key":"83779616","number":"080","name":"Designated","name":"Non ","number":"27837","date":"2010-08-24T07:00:00Z","name":"Canada","name":"Application","title":"collision detection","date":"2008-03-03T08:00:00Z","id":"414","code":"CA","date":"2009-03-03T08:00:00Z","name":"Michael Henry","mgr_name":"abc","id":"79616","name":"oen","claims":"74","date":"2012-03-03T08:00:00Z","claims":"8","url":"","inventors":["D.","rshi","Pa"],"guid":["23","26","25"],"towners":["XYZ"],"inventors":["D","name2","name3"],"owners":["XYZ"]}]}})
Run Code Online (Sandbox Code Playgroud)
parseJSONjQuery中有一个内置函数.
编辑:用法示例:
// make a reference
var Obj = $.parseJSON('the json object');
alert(Obj.response.docs[0].c_application_number);
Run Code Online (Sandbox Code Playgroud)
As you descend into the nodes, the name of the node goes on, so for example if you have a JSON object like this:
{
"parent": {
"sibling": "you found a sibling",
"child": {
"more_children": "hello"
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用这样的代码:
var json = $.parseJSON('{ "parent": { "sibling": "you found a sibling", "child": { "more_children": "hello" } } }');
// I want to get the sibling value
alert(json.parent.sibling);
// I want to get the children value
alert(json.parent.child.more_children);
Run Code Online (Sandbox Code Playgroud)
演示.
| 归档时间: |
|
| 查看次数: |
903 次 |
| 最近记录: |