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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:19:00+00:00 2026-05-15T16:19:00+00:00

for this json api response I am able to parse with json_decode: $string =

  • 0

for this json api response I am able to parse with json_decode:

 $string = '{"name": "Google",
     "permalink": "google",
     "homepage_url": "http://google.com",
     "blog_url": "http://googleblog.blogspot.com",
     "blog_feed_url": "http://googleblog.blogspot.com/feeds/posts/default?alt=rss",
     "twitter_username": "google",
     "category_code": "search",
     "number_of_employees": 20000,
     "founded_year": 1998,
     "founded_month": 9,
     "founded_day": 7,// bla bla.....}';

$obj=json_decode($string);
echo $obj->number_of_employees."<br>";// 20000
echo $obj->founded_year; //1998

I am getting result with above but getting blank result with below one:

$string =  '{"offices":
  [{"description": "Google Headquarters",
    "address1": "1600 Amphitheatre Parkway",
    "address2": "",
    "zip_code": "",
    "city": "Mountain View",
    "state_code": "CA",
    "country_code": "USA",//blah blah }]//blah blah...}';

$obj=json_decode($string);
echo $obj->address1."<br>";// ""
echo $obj->city; //""

I am aware that address1 is again inside another array or loop but dont know how to retrieve it…any ideas??

  • 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-15T16:19:01+00:00Added an answer on May 15, 2026 at 4:19 pm

    You will need something like:

    foreach($obj->offices as $office) {
        echo $office->address1; // The first would be '1600 Amphitheatre Parkway'
    }
    

    To view contents of your decoded json do something like the following:

    echo "<pre>";
    print_r($obj);
    echo "</pre>";
    

    In your case this would give you:

    stdClass Object
    (
        [offices] => Array
            (
                [0] => stdClass Object
                    (
                        [description] => Google Headquarters
                        [address1] => 1600 Amphitheatre Parkway
                        [address2] => 
                        [zip_code] => 
                        [city] => Mountain View
                        [state_code] => CA
                        [country_code] => USA
                    )
    
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First of all, it's a really bad idea to use… May 16, 2026 at 9:17 am
  • Editorial Team
    Editorial Team added an answer If you are not dead set on using a listbox,… May 16, 2026 at 9:17 am
  • Editorial Team
    Editorial Team added an answer killproc will terminate programs in the process list which match… May 16, 2026 at 9:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm very new to JSON, and I need to parse some that an API
I am performing the following AJAX call: $(document).ready(function() { $.getJSON('https://sendgrid.com/api/user.stats.json', { 'api_user': 'me@mydomain.com', 'api_key':
We have published a json api to share data between a few domains. We
I have an app running Rails 2.3.5 that has a JSON API for much
I'm calling in values using PHP to cURL a site's API. I'm able to
function json (url){ $.getJSON(url, function(data) { return data; }) } this function don't see
I am working on this jsFiddle: http://jsfiddle.net/8vWXZ/10/ I want to post the order of
EDIT: This question is now redundant since Twitter no longer supports basic auth. I've
The answer to just about every single question about using C# with JSON seems
I've been looking at this for the last couple of hours. I've tried googling

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.