JSON Schema is a vocabulary that allows you to annotate and validate JSON documents.
- describes your existing data format
- clear, human- and machine-readable documentation
- complete structural validation, useful for
- automated testing
- validating client-submitted data
- make any JSON format a hypermedia format - no constraints on document structure
- use URI Templates with instance data
- describe client data for use with links using JSON Schema
- recognize collections and collection items coming soon!
The JSON Schema project intends to shepherd the Core, Validation, and Hyper-Schema specifications to RFC status. Currently, we are continuing to improve our self-published Internet-Drafts. The next step will be to get the drafts adopted by an IETF Working Group.
In the meantime, publication of Internet-Draft documents can be tracked through the IETF:
Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize the text.
[NOTE: There is likely to be a one to two month gap before the publication of the draft-07 documents]
The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from draft to draft. However, these are still drafts, and given a clear enough need validated with the user community, major changes can occur.
Progress on the next set of Internet-Drafts can be tracked on GitHub. The current milestone is draft-07 (wright-*-02)
The JSON document being validated or described we call the instance, and the document containing the description is called the schema.
The most basic schema is a blank JSON object, which constrains nothing, allows anything, and describes nothing:
You can apply constraints on an instance by adding validation keywords to the schema. For example, the “type” keyword can be used to restrict an instance to an object, array, string, number, boolean, or null:
JSON Schema is hypermedia ready, and ideal for annotating your existing JSON-based HTTP API. JSON Schema documents are identified by URIs, which can be used in HTTP Link headers, and inside JSON Schema documents to allow recursive definitions.
Interested? Check out:
We encourage updating to the latest specification, as described by the draft-06 meta-schemas. However, if you are still using draft-04, you may be interested in:
Questions? Feeling helpful? Get involved on: