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 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 488k
  • Answers 488k
  • 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 Well, as you said yourself, pLastLetter is an array of… May 16, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer This will give you the top 50 most used procs… May 16, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer There are two methods. One is simple but has serious… May 16, 2026 at 8:48 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 am trying to deserialize a json response from a google api, so i
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':
I'm looking at the following API: http://wiki.github.com/soundcloud/api/oembed-api The example they give is Call: http://soundcloud.com/oembed?url=http%3A//soundcloud.com/forss/flickermood&format=json
I am using the Twitter API, and the response I get is in JSON
I'm working with Facebook API and it's search method returns a JSON response like
Do you know how can I convert a google walking directions JSON response to
So taking a look at the API doc page here: http://developers.facebook.com/docs/reference/javascript/FB.api I'm wondering if
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

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.