json_last_error

Supported Versions: PHP 5 >= 5.3.0, PHP 7, PHP 8
Returns the last error occurred
json_last_error(): int
    {

        
$json json_encode($this->jsonSerialize(), $options);



        if (
json_last_error() !== JSON_ERROR_NONE) {

            throw 
JsonEncodingException::forModel($thisjson_last_error_msg());

        }
        $json json_encode(compact('iv''value''mac''tag'), JSON_UNESCAPED_SLASHES);



        if (
json_last_error() !== JSON_ERROR_NONE) {

            throw new 
EncryptException('Could not encrypt the data.');

        }
            $this->data json_encode($data$this->encodingOptions);

        }



        if (! 
$this->hasValidJson(json_last_error())) {

            throw new 
InvalidArgumentException(json_last_error_msg());

        }
    {

        
$json json_encode($this->jsonSerialize(), $options);



        if (
json_last_error() !== JSON_ERROR_NONE) {

            throw 
JsonEncodingException::forResource($thisjson_last_error_msg());

        }
        $parameters json_decode(base64_decode(str_replace(['-''_'], ['+''/'], $encodedString)), true);



        if (
json_last_error() !== JSON_ERROR_NONE) {

            return 
null;

        }
    public function __construct($message null)

    {

        
parent::__construct($message ?: json_last_error());

    }

}
        $payload json_encode($this->createPayloadArray($job$queue$data), \JSON_UNESCAPED_UNICODE);



        if (
json_last_error() !== JSON_ERROR_NONE) {

            throw new 
InvalidPayloadException(

                
'Unable to JSON encode payload. Error code: '.json_last_error()

            );
        if (json_last_error() !== JSON_ERROR_NONE) {

            throw new 
InvalidPayloadException(

                
'Unable to JSON encode payload. Error code: '.json_last_error()

            );

        }
        $parsedValue json_decode($valuetrue);



        if (
json_last_error() === JSON_ERROR_NONE) {

            return 
$parsedValue;

        }
        $json json_decode($content);



        if (
json_last_error() === JSON_ERROR_NONE) {

            
$content $json;

        }
                if ($this->files->exists($full "{$path}/{$locale}.json")) {

                    
$decoded json_decode($this->files->get($full), true);



                    if (
is_null($decoded) || json_last_error() !== JSON_ERROR_NONE) {

                        throw new 
RuntimeException("Translation file [{$full}] contains an invalid JSON structure.");

                    }
        json_decode($value);



        return 
json_last_error() === JSON_ERROR_NONE;

    }