JSON_SCHEMA_VALIDATE
Returns a validation error message if the value doesn't match the JSON schema, using the JSON Schema syntax, or an empty string if it matches. Pass the schema first and the value to check second.
Categories: Objects
Syntax
JSON_SCHEMA_VALIDATE(schema, value)
Examples
Example 1
Input
1
{
2
"schema": {
3
"type": "object",
4
"properties": {
5
"abc": {
6
"type": "integer",
7
"minimum": 11
8
}
9
}
10
},
11
"my_action": {
12
"value1": {
13
"abc": 10
14
}
15
}
16
}
Formula
JSON_SCHEMA_VALIDATE(schema, my_action.value1)
Output
"Number at `/abc` is less than: 11"
Example 2: Returns an empty string when the value matches
Input
1
{
2
"schema": {
3
"type": "object",
4
"properties": {
5
"abc": {
6
"type": "integer",
7
"minimum": 11
8
}
9
}
10
},
11
"my_action": {
12
"value1": {
13
"abc": 12
14
}
15
}
16
}
Formula
JSON_SCHEMA_VALIDATE(schema, my_action.value1)
Output
""