Welcome to the JSON tour's First Step, where data adventures await!
Step into the magical world of JSON, the universal language of data on the web! JSON, short for JavaScript Object Notation, is like the enchanted key that unlocks the secrets of structured information. While JSON is probably the most popular format for exchanging data, JSON Schema is the vocabulary that enables JSON data consistency, validity, and interoperability at scale.
Let's Dive In!
Imagine you have a magical potion that holds the power of information. This potion, known as JSON, is made up of key-value pairs, just like the secrets whispered between wizards. Here's a glimpse:
{"wizard": "merlin",
"spell": "Abracadabra",
"power": "4" }
Let's learn about JSON Schema
Now, imagine we want to ensure that any JSON data representing a wizard follows the same structure and has the same properties.That's where JSON Schema comes in.
JSON Schema is like a set of guidelines or rules that specify the structure and content of JSON data. It defines what properties are allowed, what data types they should have, and any additional constraints they must meet.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/wizard.schema.json",
"title": "Wizard",
"description": "Information about a wizard",
"type": "object",
"properties": {
"wizard": {
"type": "string"
},
"spell": {
"type": "string"
},
"power": {
"type": "number"
}
},
"required": ["wizard", "spell", "power"]
}$Schema Keyword
The $schema keyword in JSON Schema is used to indicate the version of the JSON Schema standard being used. It provides a URL that points to the JSON Schema draft being followed for validating the JSON data. Here,the $schema keyword is set to "https://json-schema.org/draft/2020-12/schema", which indicates that the JSON Schema is based on the draft version 2020-12 of the JSON Schema standard.
Ready to embark on an adventure into the JSON realm? Test your skills by crafting a valid JSON Schema for Draft 2020-12! Click the button below to begin your journey through the JSON Kingdom!Try it yourself