$schema
In JSON Schema, $schema is a string that defines the version of the JSON Schema standard that the schema is written in.
1{ 2 "$schema": "https://json-schema.org/draft/2020-12/schema", 3 "type": "string" 4}
In the above example, the schema is written in the JSON Schema draft 2020-12. you can find the latest version of JSON Schema here.
For the tour, we have used the JSON Schema draft 2020-12.
$id
The $id keyword is a string that defines the URI of the schema.
1{ 2 "$id": "https://example.com/person", 3 "type": "object", 4 "properties": { 5 "name": { 6 "type": "string" 7 } 8 } 9}
In the above example, the schema is given a URI of https://example.com/person.
The schema URI can be used to reference the schema from other schemas using the $ref keyword.
1{ 2 "$ref": "https://example.com/person" 3}
Task
We have defined a simple schema as below.
1{ 2 "$id":"https://example.com/string", 3 "type": "string" 4}
Reference this schema in the name property using the $ref keyword in the schema given to you in the side editor.
Loading...
Output
Please click the button or use
Shift+Enter
to view the output