Tools, FAQ, Tutorials:
JSON Schema Validation for JSON String Values
What validation keywords I can use in JSON Schema to specifically validate JSON String values?
✍: FYIcenter.com
The current JSON Schema specification supports the following validation keywords
to specifically validate JSON Strings values.
They are not applied if the JSON instance is not a JSON String.
"maxLength" - If the JSON instance is a string, its length must be less than or equal to the given value. For example:
JSON Schema:
{"maxLength": "5"}
Valid JSON instance:
"Hello!"
Valid JSON instance:
3.14159
Invalid JSON instance:
"Hello world!"
"minLength" - If the JSON instance is a string, its length must be greater than or equal to the given value. For example:
JSON Schema:
{"minLength": "5"}
Valid JSON instance:
"Hello!"
Valid JSON instance:
3.14159
Invalid JSON instance:
"Hi!"
"pattern" - If the JSON instance is a string, it must result a match for the given regular expression. For example:
JSON Schema:
{"pattern": ".*@.*"}
Valid JSON instance:
"help@fyicenter.com"
Valid JSON instance:
3.14159
Invalid JSON instance:
"Hello world!"
⇒ JSON Schema Validation for JSON Array Values
2017-09-01, ∼2777🔥, 0💬
Popular Posts:
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
Where can I download the EPUB 2.0 sample book "The Metamorphosis" by Franz Kafka? You can following ...
How to use the built-in "context" object in Policy expressions? The built-in "context" object can be...
How to run CMD Commands in Dockerfile to change Windows Docker images? When building a new Windows i...
What is EPUB 2.0 Metadata "dc:creator" and "dc:contributor" elements? EPUB 2.0 Metadata "dc:creator"...