Writing a JSON Schema to Discover Duplicate Object Names

According to the following post:

Does JSON syntax allow duplicate keys in an object?

Keys with the same name in JSON are valid, but most parsers override the value with the last found value. Is there anyway duplicate names and errors thrown in the json schema? I want all json keys to have unique names in the object.


source to share

1 answer

Json-schema works with valid JSON objects, so there's nothing you can do to prevent duplicate keys.

I would suggest that you use jsonlint as a preprocess before validation with json-schema validator. It will depend on your programming language, but here you have a choice:



All Articles