json_last_error

Supported Versions: PHP 5 >= 5.3.0, PHP 7, PHP 8
Returns the last error occurred
<?php json_last_error(): int
<?php         $encoded = json_encode($value);



        if (json_last_error() !== JSON_ERROR_NONE) {

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

        }
<?php         $val = json_decode($value, true);



        if (json_last_error() !== JSON_ERROR_NONE) {

            throw ConversionException::conversionFailed($value, $this->getName());

        }