JSON Validation icon

JSON Validation

JSON Validation

JSON Validation

AI-generated

Overview

This node validates a given JSON value against a specified JSON Schema. It is useful in scenarios where you need to ensure that JSON data conforms to a particular structure or set of rules before processing it further. For example, it can be used to validate API request payloads, configuration files, or any JSON data input to ensure correctness and consistency.

Use Case Examples

  1. Validating user input JSON against a predefined schema to ensure required fields and data types are correct.
  2. Checking configuration JSON files for compliance with expected schema before applying settings.
  3. Validating JSON responses from external APIs to ensure they meet expected format before processing.

Properties

Name Meaning
Input JSON The JSON value to validate against the schema.
JSON Schema The JSON Schema definition to validate the input JSON against.
Return All Errors Whether to return all validation errors found or only the first one.

Output

JSON

  • validValue - The validated JSON value if validation succeeds.
  • validationErrors - Array of validation errors if validation fails.
  • providedValue - The original input JSON value provided for validation.

Dependencies

  • ajv (Another JSON Schema Validator) library
  • ajv-formats for additional format validations

Troubleshooting

  • Invalid JSON Schema - failed to parse JSON: Occurs if the provided JSON Schema is not valid JSON. Ensure the schema is correctly formatted JSON.
  • Invalid JSON Schema - ajv compilation failed: Happens if the JSON Schema is syntactically correct JSON but not a valid JSON Schema according to ajv. Verify the schema against JSON Schema standards.
  • Value is not JSON: The input JSON value to validate is not valid JSON. Check the input JSON for syntax errors.

Links

Discussion