Код: Выделить всё
function isJson($string) {
if ( $string != "" ) {
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
} else {
return false;
}
}
И isJson () функция вернула мне true !!!
Поэтому я получаю ошибку:
Код: Выделить всё
$string = '""';
if ( isJson($string) ) {
$array = json_decode($string, true); //
Подробнее здесь: [url]https://stackoverflow.com/questions/79339578/php-check-if-is-a-json-string-fails-with-string-with-double-quotes[/url]