JSON schema validator
- Validating JSON documents based on a JSON Schema
- (Check if the user's input matches program expectations in a simpler way and avoid if statements overload)
What other libraries (C++ or other) have this feature?
Include a code fragment with sample data that illustrates the use of this feature
{
"type": "object",
"properties": {
"first_name": { "type": "string" },
"last_name": { "type": "string" },
"birthday": { "type": "string", "format": "date" },
"address": {
"type": "object",
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" },
"country": { "type" : "string" }
}
}
}
}
- Would match this JSON document :
{
"first_name": "George",
"last_name": "Washington",
"birthday": "22-02-1732",
"address": {
"street_address": "3200 Mount Vernon Memorial Highway",
"city": "Mount Vernon",
"state": "Virginia",
"country": "United States"
}
}
JSON schema validator
What other libraries (C++ or other) have this feature?
Include a code fragment with sample data that illustrates the use of this feature
Understanding JSON Schema conventions
Schema :
{ "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "birthday": { "type": "string", "format": "date" }, "address": { "type": "object", "properties": { "street_address": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "country": { "type" : "string" } } } } }{ "first_name": "George", "last_name": "Washington", "birthday": "22-02-1732", "address": { "street_address": "3200 Mount Vernon Memorial Highway", "city": "Mount Vernon", "state": "Virginia", "country": "United States" } }