Complete the code to specify the type of the property in JSON Schema.
{
"type": "object",
"properties": {
"name": { "type": "[1]" }
}
}The type keyword defines the data type of the property. Here, name should be a string.
Complete the code to require the property in JSON Schema.
{
"type": "object",
"properties": {
"age": { "type": "number" }
},
"[1]": ["age"]
}optional instead of required.properties incorrectly.The required keyword lists properties that must be present in the JSON object.
Fix the error in the JSON Schema to correctly validate an array of strings.
{
"type": "array",
"items": { "type": "[1]" }
}object or number instead of string.items keyword.The items keyword defines the type of elements inside the array. Here, elements should be strings.
Fill both blanks to define a property with a minimum length of 5 characters.
{
"type": "object",
"properties": {
"username": {
"type": "string",
"[1]": 5,
"[2]": 10
}
}
}minimum or maximum which are for numbers, not strings.minLength and maxLength.minLength sets the minimum number of characters, and maxLength sets the maximum number of characters for a string.
Fill all three blanks to define a property that must be an integer between 1 and 100 inclusive.
{
"type": "object",
"properties": {
"score": {
"type": "[1]",
"[2]": 1,
"[3]": 100
}
},
"required": ["score"]
}number instead of integer.minimum and maximum values.The type is integer for whole numbers. minimum and maximum set the allowed range.