For the complete documentation index, see llms.txt. This page is also available as Markdown.

Validate

Validate your JSON with Json.NET Schema.

Task version: 2.0.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

Json : Object

Json input needs to be of type string or JToken.

Default: - Example: {"key":"value"}

JsonSchema : String

Json Schema to validate to. Uses Newtonsoft JsonSchema

Default: - Example: {"type": "object", "properties": {"name": {"type":"string"} } }

Name
Description

FailOnInvalidJson : Boolean

A flag to indicate whether invalid JSON should be treated as an error.

When true, validation failure or parse error is treated as an error (subject to ThrowErrorOnFailure).

When false, parse/validation errors are returned as a non-successful result with Success=false without going through error handling.

Default: - Example: true

ThrowErrorOnFailure : Boolean

If set to true, the task will throw an exception on failure.

If set to false, the task returns a result with Success = false.

Default: True Example: true

ErrorMessageOnFailure : String

Optional custom error message used when ThrowErrorOnFailure is true or when returning a failed result.

Default: - Example: -

Task Result

Name
Description

Success : Boolean

Operation complete without errors. Example: true

IsValid : Boolean

JSON was valid. Example: true

Errors : IList<String>

List of errors. Example: { An error occured..., Another error }

Error : Error

List of errors. Example: { An error occured..., Another error }

Error.Message : String

Error message.

Error.AdditionalInfo : Exception

Additional error information.

Task Changelog

Changelog for Task Frends.JSON.Validate.

[2.0.0] - 2026-08-11

Changed

  • The task now targets .NET 8.

  • Added ThrowErrorOnFailure and ErrorMessageOnFailure options: you can now choose whether the task throws an exception or returns a failed result when an error occurs, and optionally provide a custom error message.

  • Added a CancellationToken parameter to support task cancellation.

  • The Result object now includes an Error property with details when the task fails.

  • [Breaking Change] Renamed the ThrowOnInvalidJson option to FailOnInvalidJson to better reflect its purpose: it controls whether invalid JSON is treated as an error at all, independent of whether that error is thrown or returned (which is controlled by ThrowErrorOnFailure). Update any existing task configurations to use FailOnInvalidJson.

[1.0.0] - 2023-06-15

Added

  • Initial implementation

Last updated

Was this helpful?