This task performs JSON validation upon input - it can be used to validate the structure of a JSON object.
JSON Validation Settings
...
JSON key: require.object
Default value: 0
JSON path
Check if the returned JSON matches a JSON path expression. The result of the JSON path expression is not saved anywhere, however a result must be present for the validation to be successful (returned arrays must have a size > 0)
JSONPath documentation can be found here: https://github.com/json-path/JsonPath
Online JSONPath validation is available here: https://jsonpath.com/
JSON key: jsonpath
Default value: ""
JSON Configuration
Below is a set of example configuration.
Code Block |
---|
{
"max.key.length": 50,
"input": "%{REQUEST_BODY}",
"max.array.items": 1000,
"description": "Validate JSON structure is correct",
"max.depth": 50,
"response.reason": "Invalid JSON",
"require.object": false,
"max.string.value.length": 200,
"response.status": 400,
"class": "io.ceptor.pipeline.tasks.ValidateJSONTask",
"max.objects.items": 100,
"jsonpath": ""
} |