public static function parse(?string $json = null, int $options = 0, int $depth = 512): ?array
    {
        if ($json === null) {
            return null;
        }

        $json = (string) $json;

        $data = @json_decode($json, true, $depth, $options);

        if ($data === null && ($json === '' || (json_last_error()) !== JSON_ERROR_NONE)) {
            $code = json_last_error();
            if (isset($code) && ($code === JSON_ERROR_UTF8 || $code === JSON_ERROR_DEPTH)) {
                throw new ParseException(sprintf('JSON parsing failed: %s', json_last_error_msg()), -1, null, $code);
            }

            try {
                (new JsonParser())->parse($json);
            } catch (ParsingException $e) {
                throw ParseException::castFromJson($e);
            }
        }

        return $data;
    }
public static function parse(?string $json = null, int $options = 0, int $depth = 512): ?array
    {
        if ($json === null) {
            return null;
        }

        $json = (string) $json;

        $data = @json_decode($json, true, $depth, $options);

        if ($data === null && ($json === '' || (json_last_error()) !== JSON_ERROR_NONE)) {
            $code = json_last_error();
            if (isset($code) && ($code === JSON_ERROR_UTF8 || $code === JSON_ERROR_DEPTH)) {
                throw new ParseException(sprintf('JSON parsing failed: %s', json_last_error_msg()), -1, null, $code);
            }

            try {
                (new JsonParser())->parse($json);
            } catch (ParsingException $e) {
                throw ParseException::castFromJson($e);
            }
        }

        return $data;
    }
public static function parse ( ? string $ json = null , int $ options = 0 , int $ depth = 512 ) : ? array { if ( $ json === null ) { return null ; } $ json = ( string ) $ json ; $ data = @ json_decode ( $ json , true , $ depth , $ options ) ; if ( $ data === null && ( $ json === '' || ( json_last_error ( ) ) !== JSON_ERROR_NONE ) ) { $ code = json_last_error ( ) ; if ( isset ( $ code ) && ( $ code === JSON_ERROR_UTF8 || $ code === JSON_ERROR_DEPTH ) ) { throw new ParseException ( sprintf ( 'JSON parsing failed: %s' , json_last_error_msg ( ) ) , - 1 , null , $ code ) ; } try { ( new JsonParser ( ) ) -> parse ( $ json ) ; } catch ( ParsingException $ e ) { throw ParseException :: castFromJson ( $ e ) ; } } return $ data ; }
Parses JSON into a PHP array.

@param int $options Bitmask of JSON decode options
@param int $depth   Recursion depth

@throws ParseException If the JSON is not valid
Parses JSON into a PHP array .