I am trying to decode json string that looks like the one below with json_decode php function:
"{id:"1",fields:[{id:"1",value:"asdasd"},{id: "2",value:"asdasd"},{id:"3",value:"asdasd"}]}"
I have tried various options from this question. Like:
$foo = utf8_encode($json_string);
$data = json_decode($foo, true);
Or:
json_decode(str_replace ('\"','"', $json_string), true);
Even with:
json_decode( preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $json_string), true );
But, everything I try I always get null
.
Why is that?
"
. Voting to close as typo/non-repro/not-useful-to-others-in-future. – T.J. Crowder Dec 13 '17 at 12:08{"id":"1"
not{id:"1"
– freelancer Dec 13 '17 at 12:09