Skip to main content

JSON/schema matching

The value must be a valid JSON matching a JSON schema.

Parameter table

paramunitrequireddescription
keyyesThe key of the JSON value to validate.
schemayesThe JSON schema to validate against.

How to setup

This rule checks whether the JSON value associated with the specified (key) matches the specified JSON (schema). The Schema describes the structure and format of the JSON data. If the JSON value does not match the schema, the rule will fail.

For more information about JSON Schema, please refer to the official documentation.

Creator tips

JSON Schema is a specification that defines a JSON-based format for describing the structure and constraints of JSON data. It serves as a blueprint or a set of rules that outline the expected properties, data types, and relationships within a JSON document. This rule can be used to validate your JSON data against a JSON schema.

To build a valid JSON that matches the schema, you have to follow the structure of the JSON schema and the data types of the elements. For a quick tutorial about JSON, check out the W3Schools tutorial. You can also refer to the examples.

Examples

valuevalidschemadescription
{"key": "value"}
{
"properties": {
"key": {
"type": "string"
}
},
"type": "object"
}
The JSON value matches the schema.
{"key": 1}
{
"properties": {
"key": {
"type": "string"
}
},
"type": "object"
}
The JSON value does not match the schema.