I have API that looks like this.
The products
object contains Product IDs (keys) and their amount in basket (values).
{
"id": "0a4d44aa-2ace-11e7-93ae-92361f002671",
"products": {
4 => 3, // product with ID 4 is 3x in basket
10 => 1, // product with ID 10 is 1x in basket
...
},
// some other values...
}
a) How can I describe this API with MSON?
b) Is this schema correct?
{
"type": "object",
"properties": {
"id": {
"type": "string",
},
"products": {
"type": "object",
"properties": {
"productId": {
"type": "int",
}
}
},
// some other values
}
}