PHP
Pull request Compare This branch is 10 commits ahead, 1 commit behind jesstelford:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
seleniumTests
src
LICENSE
README.md
package.xml

README.md

JSON Schema PHP Validator

Validates PHP objects using JSON Schema (http://www.json.com/json-schema-proposal/)

$ pear channel-discover maetl.github.com/json-schema
$ pear install json-schema/JsonSchema

JSON Schema

JSON Schema is a specification for a JSON-based format for defining the structure of JSON data. JSON Schema provides a contract for what JSON data is required for a given application and how it can be modified, much like what XML Schema provides for XML. JSON Schema is intended to provide validation, documentation, and interaction control of JSON data. - http://code.google.com/p/jsonschema/

JSON Schema Validator for PHP

Json schema validator in php. It is a PHP class that validates a json data structure against a schema definition. It is a simple class that returns an object containing the result and errors that happened. - http://sourceforge.net/projects/jsonschemaphpv/

Usage Example

require_once 'JsonSchema.php';

$schema = json_decode('{ type : "object", properties : { a : { type : "string" }} }');
$json = json_decode('{ a : 1 }');

$result = JsonSchema::validate(
    $json,
    $schema
);

if (!$result->valid) {
    echo "Errors: \n";
    print_r($result->errors);
}