In this page, you will find examples illustrating different use cases to help you get the most out of your JSON Schemas. These examples cover a wide range of scenarios, and each example comes with accompanying JSON data and explanation, showcasing how JSON Schemas can be applied to various domains. You can modify these examples to suit your specific needs, as this is just one of the many ways you can utilize JSON Schemas.
A schema representing an address, with optional properties for different address components which enforces that locality , region , and countryName are required, and if postOfficeBox or extendedAddress is provided, streetAddress must also be provided.
Data
A schema representing a blog post, including properties like title , content , publishedDate , author , and tags .
< " $id " : "https://example.com/blog-post.schema.json" , " $schema " : "https://json-schema.org/draft/2020-12/schema" , " description " : "A representation of a blog post" , " type " : "object" , " required " : [ "title" , "content" , "author" ] , " properties " : < " title " : < " type " : "string" >, " content " : < " type " : "string" >, " publishedDate " : < " type " : "string" , " format " : "date-time" >, " author " : < " $ref " : "https://example.com/user-profile.schema.json" >, " tags " : < " type " : "array" , " items " : < " type " : "string" >> > >Data
< " title " : "New Blog Post" , " content " : "This is the content of the blog post. " , " publishedDate " : "2023-08-25T15:00:00Z" , " author " : < " username " : "authoruser" , " email " : "[email protected]" > , " tags " : [ "Technology" , "Programming" ] >A schema representing an event in a calendar, including properties like startDate , endDate , summary , location , and recurrenceDate details. The geo property is a reference ( $ref ) to another schema defined at a different location which represents a geographical location with latitude and longitude values.
Data
This schema represents electronic devices with a deviceType property that determines the device's category, such as smartphone or laptop . It employs the oneOf keyword to dynamically reference schemas based on the deviceType property. This flexible schema structure allows data to conform to the appropriate device schema based on the deviceType specified, making it easy to describe different electronic devices with their unique characteristics. When deviceType is set to smartphone , the schema enforces properties specific to smartphones, and when deviceType is set to laptop , it enforces properties specific to laptops.
Data
A schema representing an ecommerce system, where $anchor is used within the definitions of product and order schemas to define anchor points: ProductSchema and OrderSchema , respectively.
< " $id " : "https://example.com/ecommerce.schema.json" , " $schema " : "https://json-schema.org/draft/2020-12/schema" , " $defs " : < " product " : < " $anchor " : "ProductSchema" , " type " : "object" , " properties " : < " name " : < " type " : "string" >, " price " : < " type " : "number" , " minimum " : 0 >> > , " order " : < " $anchor " : "OrderSchema" , " type " : "object" , " properties " : < " orderId " : < " type " : "string" >, " items " : < " type " : "array" , " items " : < " $ref " : "#ProductSchema" >> > > > >Data
A schema representing geographical coordinates with latitude and longitude values within specified ranges.
Data
A schema representing a health record, including patientName , dateOfBirth , bloodType , allergies , conditions , medications , and emergencyContact .
Data
A schema representing a job posting, including properties like title , company , location , description , employmentType , salary , and applicationDeadline . It also uses the $anchor keyword for defining an anchor.
Data
A schema representing a movie, including properties such as title , director , release date , genre , duration , and cast members .
Data
A schema representing a user profile, including properties like username , email , fullName , age , location , and interests .