I have a column of datatype array in sql like:
This value is received as :
$customlabel = "{new,\"tree test123\",de}"
I tried json_decode($customlabel, TRUE)
to get it into array. But this just returns empty string
I have a column of datatype array in sql like:
This value is received as :
$customlabel = "{new,\"tree test123\",de}"
I tried json_decode($customlabel, TRUE)
to get it into array. But this just returns empty string
This is not valid JSON. You can not decode the JSON. So you can consider it as a string and my answer would be..
$customlabel = html_entity_decode("{new,\"tree test123\",de}");
$customlabel = str_replace(array('{', '}'), '', $customlabel);
$customlabel = explode(',', $customlabel);
$customlabel = array_map('strval', $customlabel);
print_r($customlabel);
Your output will be...
Array ( [0] => new [1] => "tree test123" [2] => de )