Jump to content

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?



Link to comment
Share on other sites

This topic is now closed to further replies.
  • 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.