Skip to main content


Checks messages against a provided JSONSchema definition but does not change the payload under any circumstances. If a message does not match the schema it can be caught using error handling methods outlined here.

# Common config fields, showing default values
label: ""
schema: ""
schema_path: ""

Please refer to the JSON Schema website for information and tutorials regarding the syntax of the schema.



A schema to apply. Use either this or the schema_path field.

Type: string
Default: ""


The path of a schema document to apply. Use either this or the schema field.

Type: string
Default: ""


An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: array
Default: []


With the following JSONSchema document:

"$id": "",
"$schema": "",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
"lastName": {
"type": "string",
"description": "The person's last name."
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0

And the following Benthos configuration:

- json_schema:
schema_path: "file://path_to_schema.json"
- catch:
- log:
level: ERROR
message: "Schema validation failed due to: ${!error()}"
- bloblang: 'root = deleted()' # Drop messages that fail

If a payload being processed looked like:


Then a log message would appear explaining the fault and the payload would be dropped.