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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:48:27+00:00 2026-06-09T06:48:27+00:00

Ok, so I have this in a JSON array (the output of retrievedData() )

  • 0

Ok, so I have this in a JSON array (the output of retrievedData())

{
    "device": {
        "01AA02AB141208VV": {
            "$version": -148598935,
            "$timestamp": 1344382016000,
            "serial_number": "01AA02AB141208VV"
        }
    }
}

However, I can’t seem to select the serial number. I have tried what usually works, but I can’t select it. This is assuming we don’t already know the “01AA02AB141208VV”.

$retrieved_data = retrieveData($array['userid'], $array['urls']['transport_url'], $array['access_token']);
$retrieved_data_array = json_decode($retrieved_data, true);
$serial_number = $retrieved_data_array['device'][0]['serial_number'];

Am I doing something wrong? I bet it’s really simple, but I just cannot figure it out!

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-06-09T06:48:29+00:00Added an answer on June 9, 2026 at 6:48 am

    you can use key() function to access the keys of the associative array (in this case the ‘$retrieved_data_array[‘device’]’ array:

    <?php
    
    $data = '{"device": {"01AA02AB141208VV": {"$version": -148598935,"$timestamp": 1344382016000,"serial_number": "01AA02AB141208VV"}}}';
    
    $retrieved_data_array = json_decode($data, true);
    $serial_number = key($retrieved_data_array['device']);
    reset($retrieved_data_array['device']);
    
    print_r($serial_number);
    print_r($retrieved_data_array['device'][$serial_number]);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json output array like this { data: [ { name: Ben
i have this JSON: var projects_array = new Array( {name:myName1, id:myid1, index:1}, {name:myName2, id:myid2,
I have a JSON array like this: { forum:[ { id:1, created:2010-03-19 , updated:2010-03-19
I have some troubles mapping a JSON Array to RestKit. This is what the
I have a json object that looks something like this: Array ( [algorithm] =>
I have my json array with is this : [{id:1,cid:1,da:08:00:00,a:12:00:00,data:2011-07-03,persone:3,nome:Via Bligny}, {id:8,cid:1,da:08:30:00,a:14:45:00,data:2011-09-26,persone:2,nome:Via Bligny}, {id:9,cid:1,da:08:30:00,a:14:15:00,data:2011-09-26,persone:2,nome:Via
[I have some code to create a JSON array. In this code I am
I have this following method that connectss to db and returns a json array.
i have this JSON object: {error:null, result:[{id:1234567890, count:1, recipients: [u3848, u8958, u7477474 ], dateCreated:2012-06-13T09:13:45.989Z
I have this JSON http://www.progmic.com/ielts/retrive.php that I need to parse. When I do it

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.