2016-09-15 95 views
1
{ "httpCode": "200", 
    "status": "success", 
    "message": "SuccessFully Listed", 
    "details": {"result": [{"Id": 1,"Key": "B33C78A0-C598-4071-863B-EF6B6978F790","Name": "Windows","ShortName": "Win"}]}} 

這是我的Json結果我需要獲取結果列表。如何獲得結果?獲取JSON列表樹值

回答

0

如果陣列格式,您可以解析JSON

var det = JSON.parse('{ "httpCode": "200", 
    "status": "success", 
    "message": "SuccessFully Listed", 
    "details": {"result": [{"Id": 1,"Key": "B33C78A0-C598-4071-863B-EF6B6978F790","Name": "Windows","ShortName": "Win"}]}}'); 

alert(det['details']['result']); 
0

使用點操作

var obj = { "httpCode": "200", 
    "status": "success", 
    "message": "SuccessFully Listed", 
    "details": {"result": [{"Id": 1,"Key": "B33C78A0-C598-4071-863B-EF6B6978F790","Name": "Windows","ShortName": "Win"}]}} 

console.log(obj.details.result[0].Name)