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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:11:14+00:00 2026-06-05T19:11:14+00:00

struggle extracting necessary data from this complex json stored inside php variable. Via php

  • 0

struggle extracting necessary data from this complex json stored inside php variable.

Via php script, I called yql.
Data returned and assigned to $retarr;

Then further down, $retarr[2] is storing the full values as below:

$debugarrays= print_r($retarr[2], true);
echo "<pre>";
echo $debugarrays;
echo "</pre>";


cbfunc({
   "query":{
      "count":10,
      "created":"2012-06-13T09:13:45Z",
      "lang":"en-US",
      "results":{

         "contact":[    

            {
               "created":"2006-10-29T04:32:07Z",
               "updated":"2006-10-29T04:32:07Z",
               "uri":"http://social.yahooapis.com/v1/user/MNQJOMYDQYLY2FZSMROV4QDA6MI/contact/12",
               "isConnection":"false",
               "id":"12",
               "fields":[
                  {
                     "created":"2006-10-29T04:32:07Z",
                     "updated":"2006-10-29T04:32:07Z",
                     "uri":"http://social.yahooapis.com/v1/user/MNQJOMYDQYLY2FZSMROV4QDA6MI/contact/12/email/6",
                     "id":"6",
                     "type":"email",
                     "value":"jaq@lifemastr.com",
                     "editedBy":"OWNER"
                  },
                  {
                     "created":"2006-10-29T04:32:07Z",
                     "updated":"2006-10-29T04:32:07Z",
                     "uri":"http://social.yahooapis.com/v1/user/MNQJOMYDQYLY2FZSMROV4QDA6MI/contact/12/name/5",
                     "id":"5",
                     "type":"name",
                     "value":{
                        "givenName":"'Jaq'",
                        "middleName":null,
                        "familyName":null,
                        "prefix":null,
                        "suffix":null,
                        "givenNameSound":null,
                        "familyNameSound":null
                     },
                     "editedBy":"OWNER"
                  }
               ]
            } 


         ]
      }
   }
});


$sJson= $retarr[2];
$aNative   = json_decode($sJson);
print_r($aNative);


echo $retarr[2]->fields[0]->id."<br>";
echo $retarr[2]->fields[0]->type."<br>";
echo $retarr[2]->fields[0]->value."<br>";

Fail to get required value…

  • 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-05T19:11:16+00:00Added an answer on June 5, 2026 at 7:11 pm

    That would appear to be a JSONP string, which is not ‘pure’ json. It’s JSON that’s been wrapped in a callback function – JSONP is used to get around the AJAX cross-domain request restrictions, and this callback business is part of that.

    You’ll have to strip off the leading cbfun( and trailing ); to get the real JSON data, which you can then pass into json_decode().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggle extracting necessary data from this json stored inside php variable. Not yet
Here is another JSON question (I always struggle with arrays). My PHP code returns
I struggle to use a jquery selector containing brakcets. Basically I parse a JSON
With C++, I struggle to understand one compilation error. I have this function, with
I struggle with JSON and jQuery so I'm hoping to get some help figuring
I struggle to write Makefiles and I'm building up some examples to learn from.
This is a continuation of the ongoing struggle to reduce my memory load mention
I'm a complete C# AND MVC noob, so this one's been a bitter struggle
I always struggle with dealing with normalised data, and how I display it. Maybe
I'm a Scala beginner and this piece of code makes me struggle. Is there

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.