Reputation: 3532
There is json structure like this
{
"1234": "abcd",
"2345": "bcdf",
"3456": "cdfg"
}
So generally it is object (array) with unique keys it is not necessarily in this sequence and with strings as values.
Question is, what's the best way to describe unique keys in json schema? I tried to read the json schema drafts from different sources, but still this task is kinda dim for my mind. If there is schema masters out here who may clarify my concerns. I would highly appreciate any thoughts!
Upvotes: 1
Views: 745
Reputation: 191799
It's not valid to have non-unique keys in JSON, so it doesn't seem to be a part of the JSON schema definition since it would already be a problem for underlying JSON parsers. Usually the solution is just to use whatever the last declared item is.
From what I can tell there is no way to enforce a check on this via JSON schema itself.
Upvotes: 1