Any assistance is greatly appreciated.
I'm a newcomer to JSON and JSON schema. I attempted to create a JSON schema for an array of tuples but it's not validating multiple records like a loop for all similar types of tuples. Below is a JSON sample:
{
"Data":
[
[ 100, "Test", 2.5 ],
[ 101, "Test1", 3.5]
]
}
I used the website jsonschema.net to generate the following schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"Data": {
"id": "http://jsonschema.net/Data",
"type": "array",
"items": [
{
"id": "http://jsonschema.net/Data/0",
"type": "array",
"items": [
{
"id": "http://jsonschema.net/Data/0/0",
"type": "integer"
},
{
"id": "http://jsonschema.net/Data/0/1",
"type": "string"
},
{
"id": "http://jsonschema.net/Data/0/2",
"type": "number"
}
],
"required": [
"0",
"1",
"2"
]
},
{
"id": "http://jsonschema.net/Data/1",
"type": "array",
"items": [
{
"id": "http://jsonschema.net/Data/1/0",
"type": "integer"
},
{
"id": "http://jsonschema.net/Data/1/1",
"type": "string"
},
{
"id": "http://jsonschema.net/Data/1/2",
"type": "number"
}
]
}
],
"required": [
"0",
"1"
]
}
},
"required": [
"Data"
]
}
The issue with this schema is that it generates specific schemas for each type of tuple. Can anyone guide me on creating a generic schema to validate each tuple in a more flexible manner? The number of tuples may vary.