I want to check particular value for multiple entry in a json file. I wrote a JsonSchema but it is not show me correct result.
For example:
"student": [
{
"main": false,
"name": "Robert"
},
{
"main": true,
"name": "Jannet"
},
{
"main": false,
"name": "Julie"
}
]
the json file will be validate if it has only one true for "main" and rest will be false. If it has multiple true it will not validate. I tried the below jsonSchema:
"student":{
"type":"array",
"items":{
"type":"object",
"required":["name","main"],
"properties":{
"name":{
"type":"string"
},
"main":{
"type":"boolean"
}
},
"anyOf":[
{
"properties":{
"main":
{
"enum":[true]
}
}
}
]
}
}