There are 3 differences from normal JSON:
- Not needed shielding.
- Arrays are not separated by a comma.
- Many arrays are right in the root.
Like that:
$str = '[\"1\",\"2\"][\"15\",\"16\"]'; // Убираем экранирование, делим по ] и собираем уже с запятой $str = implode('],', explode(']', str_replace("\\", '', $str))); // ["1","2"],["15","16"], // Помещаем в литералы массива и обрезаем лишнюю запятую в конце $str = '[' . substr($str, 0, -1) . ']'; // [["1","2"],["15","16"]] // Преобразуем в массив $str = json_decode($str);
But this is only for sample input.
If there is another format, this may not help.
To do this, write parsers, and this is just string processing.
[1,7]that you propose to get the number 86, I cannot imagine - Mike