I simply do not understand the syntax for accessing JSON data in PHP. I've been fiddling about with this for awhile . I'm too javascript-ish to understand.
$patchData = $_POST['mydata'];
$encoded = json_encode($patchData,true);
$patchDataJSON = json_decode($encoded,true);
/* what my JSON object looks like
{"patch_name":"whatever","sound_type":{
"synths":[
{"synth_name":"synth1","xpos":"29.99999725818634","ypos":"10.000012516975403"},
{"synth_name":"synth2","xpos":"1.999997252328634","ypos":"18.000012516975403"},
]
}
}
*/
$patchName = $patchDataJSON['patch_name']; // works!
$soundType = $patchDataJSON['sound_type']; // trying to access innards of JSON object. Does not work
echo $soundType; // Does not work.