FRENDS⁴ Common Components : Frends.Common.Data.ValidateData.ValidateJSON

This task takes a JSON document as an input and validates it against a given JSON schema. The task returns boolean True if the validation was successfull or a string containing validation errors if any were found.

Input Parameters

  • Input
    • The document that validation will be preformed against
      • JSON as a C# String
      • C# JObject
  • JSONSchema
    • The JSON schema that the input will be validated against.

Output Result

  • Boolean
    • True if the document was valid
  • String
    • A string containing validation errors if any validation errors were found for example Invalid type. Expected String but got Null. Line 2, position 21.

Example Usage

For JSON Schema examples and documentation see JSON Schema

Errors

The task will return an exception The input data was not recognized as JSON. Supported formats are JSON string and JObject. if the input data or the XSLT document could not be read correctly.