json_last_error_msg

Supported Versions: PHP 5 >= 5.5.0, PHP 7, PHP 8
Returns the error string of the last json_encode() or json_decode() call
<?php json_last_error_msg(): string
<?php         $encoded = json_encode($value);



        if (json_last_error() !== JSON_ERROR_NONE) {

            throw ConversionException::conversionFailedSerialization($value, 'json', json_last_error_msg());

        }



        return $encoded;