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 6972185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:56:09+00:00 2026-05-27T16:56:09+00:00

Here is the JSON being pulled in from a feed: { query: { count:

  • 0

Here is the JSON being pulled in from a feed:

{
 "query": {
  "count": 1,
  "created": "2011-12-20T14:52:50Z",
  "lang": "en-US",
  "results": {
   "nowplaying": {
    "song": {
     "title": "Silent Night",
     "artist": "Jaci Velasquez",
     "time": "2011-12-20 09:49:51"
    }
   }
  }
 }
}

I know the feed is coming correctly. I am trying to pull in the “title” with the following, but it doesn’t seem to work:

<?php foreach($feed->query->results->nowplaying as $item) { ?>
            <?php echo $item->title; ?>
<?php  } ?>

I’m not sure what I am missing. Any tips?! Thanks!

  • 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-27T16:56:09+00:00Added an answer on May 27, 2026 at 4:56 pm

    How are you getting and parsing it? If you are getting it as a string, which you most likely are, you first need to parse it with json_decode. You can specify true as the second parameter to get an array instead of an object, it’s easier to work with.

    $feed = json_decode($json, true);
    

    Then you can access individual properties like an associative array. Seeing as there are no arrays in that JSON, there is no need for any loop.

    $song = $feed['query']['results']['nowplaying']['song']['title'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem. I have data being returned using JSON, AJAX from my php
Currently I'm using the helper methods outlined here to return some JSON from my
I couldn't find anything about getting the total JSON record count using jQuery. Here
I have the following JSON structure, being returned from an AJAX call (pseudo values)
Here's the JSON string returned from my action: [{Key:Likes,Value:1},{Key:Loves,Value:0},{Key:Dislikes,Value:0},{Key:Message,Value:Your vote has been changed}] Here's
Is it possible to exclude certain fields from being included in the json string?
Having some trouble getting a JSON feed to load from my site. I'm starting
I have some Json being returned from facebook which I'm then parsing in to
I have the following JSON object being returned from my webserver. I can't figure
I can see from the jqGrid JSON data being posted to the browser that

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.