Annotate and validate data structures with JSON Schema

“JSON Schema is a vocabulary that allows you to annotate and validate JSON documents.”

JSON Schema gives you a straightforward way to provide type information and validation to existing data structures. Say, for example you have a product instance like this (converted from your language’s native object or general data structure format using a tool like Jackson for Java):

Now instead of just a loosely-typed set of properties you have an interchangeable message format with strict types like number, string or array, which allows machines to automatically process and make inferences about your existing data structures regardless of programming language and view technology. By using another tool like JSON Editor, for instance, you can automatically generate HTML forms and CRUD UIs just from a mere schema definition! Tools like Angular Schema Form (for AngularJS 1.x) and JSONForms (both AngularJS 1.x and Angular >= 2.x) even allow you to have forms within a complex application generated automatically from JSON Schema definitions.

In addition to type definitions and nested structures JSON Schema also accounts for formats like time, date-time, email or phone (see this example) and validations like minimum (see here for a complete walk-through), which gives you the added benefit of CRUD UIs that automatically validate entered data without you as a developer having to laboriously write validation rules by hand.