Validate JSON

Validate Json

To ensure that data has a particular structure, this action can be used to validate a Json structure against a Json Schema (opens in a new tab).

Validate Json

Name: general/validateJson@v1
Description: Validate a Json structure against a Json Schema. The workflow execution will fail if the data does not match with the schema.
Version: v1

Input

The attributes key takes the following input:

ParameterTypeDescriptionRequired
schemaobjectThe Json Schema.
dataJson structureThe structure to validate the Json Schema against.

Output

ParameterTypeDescriptionRequired
dataJson structureThe validated Json structure.

Usage

YAML
- id: validateJson
  name: general/validateJson@v1
  attributes:
    schema:
      type: object
      properties:
        name:
          type: string
        age:
          type: number
      required:
        - name
        - age
      additionalProperties: false
    data:
      name: 'Jan'
      age: 18