September 2018
Intermediate to advanced
764 pages
20h 6m
English
So, let's construct the schema for our user profile object using JSON Schema. To do that, we must first understand its syntax.
The first thing to note is that a JSON Schema is itself a JSON object. Therefore, the simplest JSON Schema is simply an empty object:
{}
This empty object schema will allow any type of data, so it is pretty much useless. For it to be useful, we must describe the type of data we expect. This can be done through the type keyword. The type keyword expects its value to be either a string, where only one type is allowed, or an array, where any types specified in the array are allowed.
We expect our input for the user profile object to only be objects, and so we can specify a type of "object" ...
Read now
Unlock full access