Number of input and output field
| Number of input field |
: |
One |
| Number of output field |
: |
One |
JSONSchemaValidator is used to validate a JSON document against a predefined JSON schema.
The following JSON Schema versions are supported:
- 2020-12
- 2019-09
- draft-07
- draft-06
- draft-04
- draft-03
Parameters
- JSON Schema File
A file that contains the JSON schema definition.
Output
- Outputs valid when the JSON document conforms to the predefined JSON schema.
- Outputs not valid, error-message when the JSON document does not conform to the predefined JSON schema, where error-message describes the validation error.
Example
JSON Schema
{
"$id": "https://example.com/arrays.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "A representation of a person, company, organization, or place",
"type": "object",
"properties": {
"fruits": {
"type": "array",
"items": {
"type": "string"
}
},
"vegetables": {
"type": "array",
"items": { "$ref": "#/$defs/veggie" }
}
},
"$defs": {
"veggie": {
"type": "object",
"required": [ "veggieName", "veggieLike" ],
"properties": {
"veggieName": {
"type": "string",
"description": "The name of the vegetable."
},
"veggieLike": {
"type": "boolean",
"description": "Do I like this vegetable?"
}
}
}
}
}
Valid JSON Document
{
"fruits": [ "apple", "orange", "pear" ],
"vegetables": [
{
"veggieName": "potato",
"veggieLike": true
},
{
"veggieName": "broccoli",
"veggieLike": false
}
]
}
Output
'valid'
Invalid JSON Document
{
"fruits": [ "apple", "orange", "pear",3 ],
"vegetables": [
{
"veggieName": "potato",
"veggieLike": true
},
{
"veggieName": "broccoli",
"veggieLike": false,
"numberas" : 5
}
]
}
Output
'not valid , errors: 3 at #/fruits/3 failed against https://example.com/arrays.schema.json#/properties/fruits/items with "Expected: [string] Found: [number, integer]"'