Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:07:47+00:00 2026-06-14T05:07:47+00:00

Possible Duplicate: Nested json to php search listing i am trying to parse some

  • 0

Possible Duplicate:
Nested json to php search listing

i am trying to parse some JSON, i currently got everything parsed on a single page, but its too much information to put on one page i want to be able to filter through it by listing the parent objects “church” and then once a parent is clicked i’d like the child (nested) objects “tracks” to be listed (basically to filter through the JSON), (think of your iPod you click on a Artist(which is the “church”) then a album (which is “album) then a track (which is “tracks” in the json)

so how do i make a parent object a link that parses the next level of JSON?

you can visit http://ggcc.tv/JSON_Parsers/Music.php to see what i have so far

please help, thank you.

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"}
  ]}},
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:07:48+00:00Added an answer on June 14, 2026 at 5:07 am

    Say you wanted to link the churches to their music, first you would loop through and the church names, put them in array, dedupe them, print them out, link them like

    $churches = array();
    
    foreach ($json['rows'] as $row)
    {
        if (!in_array($row[doc]['church'], $churches))
            $churches[] = $row[doc]['church'];
    }
    
    foreach ($churches as $church)
    {
        print '<a href="getchurchmusic.php?churchname=' . urlencode($church) . '><br />' . htmlentities($church) . '</a>'; }
    }
    

    then in getchurchmusic.php do what you are doing now but filter on church

        foreach ($json['rows'] as $row)
        {
                if ($_GET['churchname'] == $row[doc]['church'])
                {
                        /* print out songs or whatever */
    
                }
        }
    

    this is not tested, this is not efficient – you should put all this data in database, cache the file etc, and is not XSS free, it’s just rough code to give you a starting point

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP convert nested array to single array while concatenating keys? Get array's
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: jquery reading nested json I would really like to have a hard
Possible Duplicate: I have a nested data structure / JSON, how can I access
Possible Duplicate: How do I parse a string representing a nested list into an
Possible Duplicate: Changing a nested (multidimentional) array into key => value pairs in PHP
Possible Duplicate: Nested function parameters and 'this' context in Javascript I'm currently having problems
Possible Duplicate: nested functions in php throws an exception when the outer is called
Possible Duplicate: Matching Nested Structures With Regular Expressions in Python I am trying to
Possible Duplicate: What are PHP nested functions for? PHP allows nested function declarations like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.