可能重複:
How to get values of attributes from JSON using jQuery檢索WCF休息服務JSON數據返回
我已經使用jsonlint驗證了json
爲回報,它是有效的。作爲一個簡單的例子,
"JSONDataResult": "{ \"?xml\":{\"@version\":\"1.0\",\"@encoding\":\"utf-8\"},\"Root\":{\"Information\":{\"Error\":{\"ErrorNo\":\"0\",\"ErrorMsg\":null},\"Address\":{\"Address\":[{\"@AddressID\":\"1232233\",\"@Sequence\":\"1\",\"@Description\":\"Company, Building, 11 Street, County, City\"}
...更多的數據在這裏和所有正確的標籤等
使用下面的方法將返回上面的數據結構,但我不能把它分解成其組件。
$.getJSON('http://localhost/WcfRestService/RestServiceImpl.svc/json/mypostcode',
function (data) {
//tried all sorts of variations of this sort of thing: data.Root.Information.Address.Address[0]
});
任何想法將不勝感激。
粘貼時無效JSON:http://jsonformatter.curiousconcept.com/ –
它是json的一部分 – user835440
您應該提供更多關於它的信息。 –