src/File/Json.php
protected function validateSyntax()
    {
        if (!class_exists('\\Seld\\JsonLint\\JsonParser')) {
            throw new \RuntimeException(
                'If you want to validate JSON syntax using lint, you must require package "seld/jsonlint".'
            );
        }

        $parser = new \Seld\JsonLint\JsonParser();
        $result = $parser->lint($this->getContents());

        if ($result === null) {
            if (JSON_ERROR_UTF8 === json_last_error()) {
                throw new \UnexpectedValueException(
                    '"'.$this->getPath().'" is not encoded in UTF-8, could not parse as JSON'
                );
            }

            return true;
        }

        throw DecodeException::create(
            $this->getPath(),
            ['message' => $result->getMessage(), 'details' => $result->getDetails()]
        );
    }
protected function validateSyntax()
    {
        if (!class_exists('\\Seld\\JsonLint\\JsonParser')) {
            throw new \RuntimeException(
                'If you want to validate JSON syntax using lint, you must require package "seld/jsonlint".'
            );
        }

        $parser = new \Seld\JsonLint\JsonParser();
        $result = $parser->lint($this->getContents());

        if ($result === null) {
            if (JSON_ERROR_UTF8 === json_last_error()) {
                throw new \UnexpectedValueException(
                    '"'.$this->getPath().'" is not encoded in UTF-8, could not parse as JSON'
                );
            }

            return true;
        }

        throw DecodeException::create(
            $this->getPath(),
            ['message' => $result->getMessage(), 'details' => $result->getDetails()]
        );
    }
protected function validateSyntax ( ) { if ( ! class_exists ( '\\Seld\\JsonLint\\JsonParser' ) ) { throw new \ RuntimeException ( 'If you want to validate JSON syntax using lint, you must require package "seld/jsonlint".' ) ; } $ parser = new \ Seld \ JsonLint \ JsonParser ( ) ; $ result = $ parser -> lint ( $ this -> getContents ( ) ) ; if ( $ result === null ) { if ( JSON_ERROR_UTF8 === json_last_error ( ) ) { throw new \ UnexpectedValueException ( '"' . $ this -> getPath ( ) . '" is not encoded in UTF-8, could not parse as JSON' ) ; } return true ; } throw DecodeException :: create ( $ this -> getPath ( ) , [ 'message' => $ result -> getMessage ( ) , 'details' => $ result -> getDetails ( ) ] ) ; }
Validates JSON syntax using lint.

@throws DecodeException

@return bool
Validates JSON syntax using lint .