Task - Validate JSON Format
This task performs JSON validation upon input - it can be used to validate the structure of a JSON object.
JSON Validation Settings
Description
Contains a description of the task, enter the reason for its existence here.
JSON key: description
Default value: Blank
Input
Enter the input to encode or decode here - see Scripts and Macros for details on how to specify macro content.
JSON key: input
Default value: None
Maximum key length
Specify the maximum length of a key, or 0 for no limit.
JSON key: max.key.length
Default value: 0
Maximum string value length
Specify the maximum length of a string value, or 0 for no limit.
JSON key: max.string.value.length
Default value: 0
Maximum items in object
Limit the maximum number of items inside a JSON Object - use 0 for no limit.
JSON key: max.object.items
Default value: 0
Maximum items in an array
Limit the maximum number of items inside a JSON Array- use 0 for no limit.
JSON key: max.array.items
Default value: 0
Maximum depth
Specify the maximum recursive depth of objects/arrays within objects or objects, or 0 for no limit
JSON key: max.depth
Default value: 0
Maximum total size
Specify the maximum size in bytes, or 0 for no limit
JSON key: max.total.size
Default value: 0
Require JSON Object
Check if JSON object/array is required - if unchecked, value types (string, number, boolean etc. are allowed).
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.
{ "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": "" }
© Ceptor ApS. All Rights Reserved.