JSON Schema Validator

Validate JSON data against JSON Schema specifications.

Endpoint

POST https://www.acrewity.com/api/services/execute

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

n8n Integration

This service is also available via our n8n community node: @acrewity/n8n-nodes-acrewity

Operations

Validate JSON

Validate JSON data against a JSON schema

Operation ID: validate_json

Parameters

Parameter Type Required Default Description
data object Yes - JSON data to validate (can also be a JSON string)
schema object Yes - JSON schema for validation

Example Request

Validate User Registration Data:

{
  "service": "json-schema-validator",
  "operation": "validate_json",
  "parameters": {
    "data": {
      "name": "John Doe",
      "email": "john@example.com",
      "age": 28
    },
    "schema": {
      "type": "object",
      "required": ["name", "email"],
      "properties": {
        "name": { "type": "string" },
        "email": { "type": "string" },
        "age": { "type": "number" }
      }
    }
  }
}

Validate API Payload:

{
  "service": "json-schema-validator",
  "operation": "validate_json",
  "parameters": {
    "data": {
      "orderId": "ORD-12345",
      "items": [
        { "sku": "PROD-001", "quantity": 2 },
        { "sku": "PROD-002", "quantity": 1 }
      ],
      "total": 149.99
    },
    "schema": {
      "type": "object",
      "required": ["orderId", "items", "total"],
      "properties": {
        "orderId": { "type": "string" },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sku": { "type": "string" },
              "quantity": { "type": "number" }
            }
          }
        },
        "total": { "type": "number" }
      }
    }
  }
}

Validate Config with Missing Required Fields:

{
  "service": "json-schema-validator",
  "operation": "validate_json",
  "parameters": {
    "data": {
      "host": "localhost"
    },
    "schema": {
      "type": "object",
      "required": ["host", "port", "database"],
      "properties": {
        "host": { "type": "string" },
        "port": { "type": "number" },
        "database": { "type": "string" }
      }
    }
  }
}

Example Response (Valid Data)

{
  "success": true,
  "result": {
    "data": {
      "valid": true,
      "errors": [],
      "data_type": "object",
      "schema_type": "object"
    }
  },
  "credits_used": 1
}

Example Response (Invalid Data)

{
  "success": true,
  "result": {
    "data": {
      "valid": false,
      "errors": [
        "missing required field 'port'",
        "missing required field 'database'"
      ],
      "data_type": "object",
      "schema_type": "object"
    }
  },
  "credits_used": 1
}

More Examples

See Data Transformation Examples for complete workflow examples including API payload validation, configuration verification, and data quality checks.