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
Source code: https://github.com/FrendsPlatform/Frends.JSON2
Task Parameters
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"} } }
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
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
ThrowErrorOnFailureandErrorMessageOnFailureoptions: 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
CancellationTokenparameter to support task cancellation.The
Resultobject now includes anErrorproperty with details when the task fails.[Breaking Change] Renamed the
ThrowOnInvalidJsonoption toFailOnInvalidJsonto 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 byThrowErrorOnFailure). Update any existing task configurations to useFailOnInvalidJson.
[1.0.0] - 2023-06-15
Added
Initial implementation
Last updated
Was this helpful?

