I have a string "[[10,20],[30,40],[50,30]]" which can be converted into array by simply using json_decode which works fine for numeric values but it's failing for string values like "[S,M,L]" which I handled using a simple logic.
$string_value = str_replace(',', '","', $string_value); $string_value = str_replace('[', '["', $string_value); $string_value = str_replace(']', '"]', $string_value); $string_value = json_decode($string_value); This works fine for a one dimensional array like the one given above, but in case of a 2d array like [[red,green],[red],[red,blue]] it's failing.
["[with[[and]"]with]]at the end