How to convert JSON string to array (ok)

https://stackoverflow.com/questions/7511821/how-to-convert-json-string-to-array

$json_string   = '{"a":1,"b":2,"c":3,"d":4,"e":5}';

$my_array_data = json_decode($json_string, TRUE);
Array
(
    [records] => Array
        (
            [0] => Array
                (
                    [category_name] => Fashion
                    [id] => 60
                    [name] => Rolex Watch
                    [description] => Luxury watch.
                    [price] => 25000
                    [category_id] => 1
                    [created] => 2016-01-11 15:46:02
                )

            [1] => Array
                (
                    [category_name] => Movies
                    [id] => 48
                    [name] => Bristol Shoes
                    [description] => Awesome shoes.
                    [price] => 999
                    [category_id] => 5
                    [created] => 2016-01-08 06:36:37
                )

        )

)

Last updated

Was this helpful?