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

  • Home
  • SEARCH
  • 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 4075696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:19:52+00:00 2026-05-20T17:19:52+00:00

There is probably a simple response to this, but I’ve scoured the net trying

  • 0

There is probably a simple response to this, but I’ve scoured the net trying to find an answer.

Imagine the following JSON data ($json):

{'Top': [{  'Mid1': 'Value1',
            'Mid2': 'Value2',
            'Mid3': [   {'Bottom': 'Value3'},
                        {'Bottom': 'Value4'},
                        {'Bottom': 'Value5'},]
        }]}

What I’d like to do is loop through the data contained within Mid3, so that I can display Bottom1, Bottom2, etc.. so I thought this would work:

foreach($json->Top->Mid3 as $item)
{
echo $item->Bottom;
}

Does anyone know where I’m going wrong?

  • 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-05-20T17:19:52+00:00Added an answer on May 20, 2026 at 5:19 pm

    Your foreach is looking for Mid3 elements and not there child nodes.

    Use:

    foreach($json->Top->Mid3->Bottom as $item)
    {
       echo $item;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is probably is simple fix for this but I currently have code similar
I'm using .Net 2.0 and this is driving me crazy but there's probably some
There's probably a very simple reason for this, but when hydrating an object I'm
There is probably a simple answer, but I can't seem to figure it out.
I'm new with Objective-C, so there probably is a simple solution to this. I
This is probably a simple one but I cant get my head around it.
This is probably a simple question, but how do I know when a Storyboard
I am probably overlooking something really simple here but I am trying to redirect
This is probably something simple but it's driving me nuts. I'm making some pagination
This is probably very simple! I followed a tutorial from http://webdesignerwall.com/demo/jquery-sequential/jquery-sequential-list.html It works fine

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.