tengo un objeto JS
data=[{'quest':'sometext'},{'option':['a','b', 'c']}, {'cor':[0,1,0]},{'sol':'again tetx'}]Enviado como datos Ajax usando JQuery
... data:{'qs':JSON.stringify(data)}, ...Recibí el mensaje e intenté convertirlo en una matriz
$array=json_decode(json_encode($_POST['qs']), true);pero la salida es
print_r($array); \\is [{"quest":"sometext"},{"option":["a","b", "c"]}, {"cor":[0,1,0]},{"sol":"again tetx'}]Quiero hacer una matriz en PHP
$array = json_decode($_POST['qs'], true); print_r($array);Producción:
Array ( [0] => Array ( [quest] => sometext ) [1] => Array ( [option] => Array ( [0] => a [1] => b [2] => c ) ) [2] => Array ( [cor] => Array ( [0] => 0 [1] => 1 [2] => 0 ) ) [3] => Array ( [sol] => again tetx ) )