php - Converting a multi-dimensional array (javascript) to JSON (or similar) for transport -
i'm generating multi-dimensional array in javascript looks (this json representation of javascript array, it's not in json format):
"100": { "40": { "subtotal": "24.99", "turn-around": { "0": "2-4 business days", "1": "next business day (add $15.00)" }, "shipping": { "0": "ups ground - $0.00", "1": "ups 2nd day air - $14.73", "2": "ups 3 day select - $13.13" } }, "41": { "subtotal": "29.99", "turn-around": { "0": "2-4 business days", "1": "next business day (add $15.00)" }, "shipping": { "0": "ups ground - $0.00", "1": "ups 2nd day air - $14.73", "2": "ups 3 day select - $13.13" } } }
i'm trying convert json format, can import php script. i'm using json.stringify, getting result:
[null,null,null,null,null,null,null,null,... clip... null,null,null,null,null,null,null,null,null,[]]]
i'm pretty sure array's correct, because when dumping contents, this:
'1000' ... '41' ... 'subtotal' => "$24.00" 'tat' ... '0' => "- choose turnaround time -" '1' => "next business day (add $15.00)" '2' => "2-4 business days" 'shipping' ... '0' => "free ups ground - $0.00" '1' => "ups 2nd day air - $12.75" '2' => "ups 3 day select - $13.13" '3' => "ups next day air saver - $15.32" '4' => "ups next day air - $17.04" '5' => "ups next day air a.m. - $71.61"
i'm not sure why json.stringify method not working. need array readable format digest in php. perhaps there's better way?
all need multi-dimensional array in javascript multi-dimensional array in php. i'm not javascript expert, real problem here.
since able send json data php, can convert using php json_decode
function.
Comments
Post a Comment