Jump to content
Sign in to follow this  
7blake

json_decode issue

Recommended Posts

I'm grabbing an object with objects that is converted to JSON, then decoded in PHP

 

newObject = {"firstObject":{"Color" : "red"}, "secondObject":{"Color":"blue"}};

 

anyhow, I can get this to PHP fine, and access it with the foreach loops. But I can't access "firstObject" or "secondObject".

 $someArray = json_decode($_POST['containerPositions'], true);
     foreach($someArray as $value){
        foreach ($value as $secondKey){
        echo getClass($value) . " " . $secondKey;}
    }

Could someone tell me what is the correct method for accessing them?

 

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.