dojox.json.schema

Author: Kris Zyp
Project owner:Kris Zyp
since:V1.2

Contents

dojox.json.schema implements JSON Schema to provide data validation against JSON Schemas.

Introduction

JSON Schema can used to define the structure of data, constraints, and structural information using JSON. JSON Schema is used for type definitions in Service Mapping Description (SMD) used by the web services. JSON Schema is also supported in the JsonRestStore. Current development of JSON Schema is taking place in the JSON Schema Discussion Group.

Usage

The basic usage of dojox.json.schema validate data is:

obj = {foo:"bar"};
schema = {properties:{foo:{type:"string"}}};
results = dojox.json.schema.validate(obj, schema);
if(results.valid){
  // indicates that the instance is valid by the schema
}