3

I have the following already decoded json stored in $response = $result->response;:

 object(stdClass)#6 (5) {
  ["EmailAddress"]=> string(18) "[email protected]"
  ["Name"]=> string(0) ""
  ["Date"]=> string(19) "2011-10-09 19:32:00"
  ["State"]=> string(6) "Active"
  ["CustomFields"]=> array(1) {
    [0]=>object(stdClass)#7 (2) {
            ["Key"]=>string(2) "id"
            ["Value"]=>string(6) "Dl9lIz"
    }
  }

I can already access the main attributes (EmailAddress, Name, etc) with:

$email = $response->{'EmailAddress'};
print $email;

But I need to access the "Value" portion in the CustomFields object. I don't know how to dig that deep. I'm attempting to do this in PHP..

Any suggestions?

1 Answer 1

4

It is contained in the first element ([0]) of array CustomFields, so you can access it with an object operator (->) after the array index.

print $response->CustomFields[0]->Value;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.