讀取JSON數據我有一個JSON文件:使用的getJSON
{
"bible" : {
"@attributes" : {
"translation" : "ASV"
},
"testament" : [
{
"@attributes" : {
"name" : "Old"
},
"book" : [
{
"@attributes" : {
"name" : "Genesis"
}
},
{
"@attributes" : {
"name" : "Exodus"
}
},
{
"@attributes" : {
"name" : "Leviticus"
}
},
{
"@attributes" : {
"name" : "Numbers"
}
},
{
"@attributes" : {
"name" : "Deuteronomy"
}
},
{
"@attributes" : {
"name" : "Joshua"
}
},
{
"@attributes" : {
"name" : "Judges"
}
},
{
"@attributes" : {
"name" : "Ruth"
}
}
]
}
]
}
}
我使用代碼來閱讀:
$(document).ready(function(){
$.getJSON("asv/index.json", function(json) {
alert("JSON Data: " + json.bible.testament[1].name);
});
});
但是這給了我不確定。請讓我知道如何閱讀書名。還@attributes是什麼? 謝謝