I have encode a php array with json_encode and I store it into db, when I was trying to decode it into a php array I get null.
this is my php array :
'Etablissment' => array(
'id' => '79',
'telephone' => '0620000000',
'nom' => 'RESTo',
'nbmaxpersonnes' => '20',
'hoursreservation' => '{"Lundi":{"matin":{"h_debut":"0630 ","h_fin":"0830 "},"midi":{"h_debut":"0730 ","h_fin":"1300 "}},"Mardi":{"matin":{"h_debut":"0700 ","h_fin":"0500 "},"midi":{"h_debut":"1530 ","h_fin":"1400 "}}}'
),
I want to decode the hoursreservation field so I do json_decode($etablissement['Etablissment']['hoursreservation']), I work with cakephp.
the following solution not working for me:
php json decode
and
json decode in php
json_decode($array['Etablissment']['hoursreservation']);(with the array you provided) and it works fine (on my end). Maybe your array isn't a 'array'.