Json Validator icon

Json Validator

Validate data using a json scheme

Overview

The Json Validator node validates JSON data against a user-provided JSON schema using the AJV (Another JSON Schema Validator) library. It is useful in workflows where you need to ensure that incoming JSON data conforms to a specific structure or set of rules before further processing. For example, it can be used to validate API responses, user inputs, or configuration objects to prevent errors downstream.

Properties

Name Meaning
Scheme (JSON) A valid JSON schema defined using AJV format that specifies the expected structure and constraints for the input JSON data.
Input Field The name of the field in the input item that contains the JSON data to be validated. Defaults to "json".

Output

  • The output consists of the original input items that passed validation.
  • If any item fails validation, the node outputs a single item containing an error field with a textual description of the validation errors.
  • The output JSON structure mirrors the input items but only includes those that are valid according to the schema.
  • No binary data is produced by this node.

Dependencies

  • Requires the AJV library and its formats extension for JSON schema validation.
  • No external services or API keys are needed.
  • The node expects a valid JSON schema as input and JSON data in the specified input field.

Troubleshooting

  • Input field not found error: If the specified input field does not exist in an item, the node throws an error indicating which item is missing the field. Ensure the input field name matches exactly the property containing the JSON data.
  • Validation failure: When JSON data does not conform to the schema, the node outputs an error message describing the validation issues. Review the schema and input data to fix mismatches.
  • Invalid schema: Providing an invalid or malformed JSON schema may cause compilation errors. Validate your schema separately before use.
  • Empty or missing input data: If the input data is empty or undefined in the specified field, validation will fail.

Links and References

Discussion