public function validate($schema, $json)
    {
        $validator = new Validator;

        $validator->check($json, $schema);

        if (false === $validator->isValid()) {
            $errors = array();

            foreach ($validator->getErrors() as $error) {
                $errors[] = (empty($error['property']) ? '' : $error['property'] . ': ')
                          . $error['message'];
            }

            throw JSONException::errors($errors);
        }
    }
public function validate($schema, $json)
    {
        $validator = new Validator;

        $validator->check($json, $schema);

        if (false === $validator->isValid()) {
            $errors = array();

            foreach ($validator->getErrors() as $error) {
                $errors[] = (empty($error['property']) ? '' : $error['property'] . ': ')
                          . $error['message'];
            }

            throw JSONException::errors($errors);
        }
    }
public function validate ( $ schema , $ json ) { $ validator = new Validator ; $ validator -> check ( $ json , $ schema ) ; if ( false === $ validator -> isValid ( ) ) { $ errors = array ( ) ; foreach ( $ validator -> getErrors ( ) as $ error ) { $ errors [ ] = ( empty ( $ error [ 'property' ] ) ? '' : $ error [ 'property' ] . ': ' ) . $ error [ 'message' ] ; } throw JSONException :: errors ( $ errors ) ; } }
Validates the JSON data.

@param object $schema The JSON schema.
@param mixed  $json   The JSON data.

@throws JSONException If the JSON data is invalid.

@api
Validates the JSON data .