可能重複解析嵌套的JSON:
Nested json to php search listing在同一div
我試圖解析一些JSON,我現在把一切都在一個頁面上分析,但其過多信息放在一個頁面上,我希望能夠通過列出父對象「教會」來過濾,然後一旦父母被點擊,我想孩子(嵌套)對象「軌道」被列出(基本上是爲了過濾通過JSON),(想想你的iPod你點擊一個藝術家(這是「chur CH「),那麼這張專輯(這是」專輯),然後選擇曲目(這是在JSON‘軌道’)
讓我怎麼做一個父對象是JSON解析的一個新的水平有關係嗎?
,您可以訪問http://ggcc.tv/JSON_Parsers/Music.php,看看有什麼我到目前爲止
請幫忙,謝謝。
PHP: http://www.godsgypsychristianchurch.net/music.json'; $ content = file_get_contents($ filepath); $ json = json_decode($ content,true);
$count = 0;
foreach ($json['rows'] as $row) {
++$count;
echo "<h1>Row: {$count}</h1>";
echo "Album: {$row[doc]['album']}<br />";
echo "Church: {$row[doc]['church']}<br />";
echo "Description: {$row[doc]['des']}<br />";
echo "<img src=\"{$row['doc']['artwork']}\" alt=\"my image \" width=\"250\" /><br /><br />";
$songCount = 0;
foreach ($row['doc']['tracks'] as $song) {
++$songCount;
echo $song['name'] . ' - ';
$songUrl = $row['doc']['baseurl'] . urldecode($song['url']);
echo "<a href=\"{$songUrl}\">{$songUrl}</a><br />";
}
echo '<br /><br />';
}
exit;
?>
JSON(http://www.godsgypsychristianchurch.net/music.json):
{"total_rows":1,"offset":0,"rows":[
{"id":"All Things Are Possible",
"key":"All Things Are Possible",
"doc":{"_id":"All Things Are Possible",
"album":"All Things Are Possible",
"artwork":"http://godsgypsychristianchurch.net/music_artwork/DEFAULT_COVER2.png",
"baseurl":"http://www.godsgypsychristianchurch.net/music",
"church":"Atlanta GA",
"cityartwork":"http://www.ggcc.tv/LogoNE.png",
"des":"All Things Are Possible from the Atlanta GA Church, Pastor Nick White",
"tracks":[
{"name":"1 Intro",
"url":"/Atlanta%20GA/All%20things%20are%20possible/01%20Intro.mp3"},
{"name":"2 Wo si O Drom",
"url":"/Atlanta%20GA/All%20things%20are%20possible/02%20Wo%20si%20O%20drom.mp3"},
{"name":"3 Nas Murrgo Shov",
"url":"/Atlanta%20GA/All%20things%20are%20possible/03%20Nas%20murrgo%20shov.mp3"},
{"name":"4 To Cho Vos",
"url":"/Atlanta%20GA/All%20things%20are%20possible/04%20To%20cho%20vos.mp3"},
{"name":"5 Tu Son Kai Sastridas",
"url":"/Atlanta%20GA/All%20things%20are%20possible/05%20Tu%20son%20kai%20sastridas.mp3"},
{"name":"6 Now I Am Strong",
"url":"/Atlanta%20GA/All%20things%20are%20possible/06%20Now%20I%20am%20strong.mp3"},
{"name":"7 Sorr Nevee",
"url":"/Atlanta%20GA/All%20things%20are%20possible/07%20Zorr%20nevee.mp3"},
{"name":"8 Preaching",
"url":"/Atlanta%20GA/All%20things%20are%20possible/08%20Preaching.mp3"},
{"name":"9 Arkadyan Amey",
"url":"/Atlanta%20GA/All%20things%20are%20possible/09%20Arkadyan%20amey.mp3"},
{"name":"10 O Christo Ka Wudarr",
"url":"/Atlanta%20GA/All%20things%20are%20possible/10%20O%20Christo%20ka%20wudarr.mp3"},
{"name":"11 Eloi, Eloi",
"url":"/Atlanta%20GA/All%20things%20are%20possible/11%20Eloi%2C%20Eloi.mp3"},
{"name":"12 Amadow Dell",
"url":"/Atlanta%20GA/All%20things%20are%20possible/12%20Amadow%20Dell.mp3"},
{"name":"13 Sastiar Amey Devla",
"url":"/Atlanta%20GA/All%20things%20are%20possible/13%20Sastiar%20amey%20Devla.mp3"},
{"name":"14 Tu Skepeese",
"url":"/Atlanta%20GA/All%20things%20are%20possible/14%20Tu%20skepeese.mp3"},
{"name":"15 Dov Ma Godgee",
"url":"/Atlanta%20GA/All%20things%20are%20possible/15%20Dov%20ma%20godgee.mp3"},
{"name":"16 The Lord is my strength",
"url":"/Atlanta%20GA/All%20things%20are%20possible/16%20The%20Lors%20is%20my%20strength.mp3"}
]}},
上市(概覽)和細節視圖。從你的問題來看,你真的不明白什麼阻止了你想要做什麼。你在哪裏碰到路障? – hakre