What I'm trying to Do is so simple yet everything I tries had failed. I have the following string: "{"msg":"background1.jpg"}", and I want to convert it to an array to access the msg value. this should simply be done like so(or so I've thought):
$theString = "{"msg":"background1.jpg"}";
var_dump(json_decode($theString, TRUE));
The vr_dump() is dumping NULL, also tried:
var_dump(json_decode(json_encode($theString), TRUE));
This dumps string(45) "{"msg":"background1.jpg"}"
and tried many many more things, but all failed. Any thought please.
EDIT:
I'm getting the json string from database, where i have previously stored like so:
$toBeStored = json_encode(array("msg" => $value));