Click or drag to resize
Json.NET

ExtensionsIsValid Method (JToken, JsonSchema, IListString)

 

Note: This API is now obsolete.

Determines whether the JToken is valid.

Caution note Caution
JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.

Namespace:  Newtonsoft.Json.Schema
Assembly:  Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 12.0.1+509643a8952ce731e0207710c429ad6e67dc43db
Syntax
C#
[ObsoleteAttribute("JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.")]
public static bool IsValid(
	this JToken source,
	JsonSchema schema,
	out IList<string> errorMessages
)

Parameters

source
Type: Newtonsoft.Json.LinqJToken
The source JToken to test.
schema
Type: Newtonsoft.Json.SchemaJsonSchema
The schema to test with.
errorMessages
Type: System.Collections.GenericIListString
When this method returns, contains any error messages generated while validating.

Return Value

Type: Boolean
true if the specified JToken is valid; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type JToken. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also