How do i define key value pairs object in json schema (the "correct" way) ?
i want to define this:
"id" : 99,
_info : {
"name" : "somename",
"href" : "someUrl"
}
Are any of the following two accurate?:
1)
{
"type": "object",
"name": "MyObj",
"properties": {
"id": {
"type": "integer"
},
"_info": {
"type": "array",
"items": {
"type": "object"
"properties": {
"key": {
"type": "string",
"description": "key"
},
"value": {
"type": "string",
"description": "the value"
}
}
}
}
}
}
2)
{
"type": "object",
"name": "MyObj",
"properties": {
"id": {
"type": "integer",
"_info": {
"type": "object",
"additionalProperties": {
"type": "string",
"description": "string values"
}
}
}
}
What is the correct way to get this accomplished and people will know what the schema is and the object will look like when serialized/deserialized?