Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate JSON against a schema in .Net

I know there is a proposed standard for JSON schema validation, is there an implementation in .NET?

like image 782
AwkwardCoder Avatar asked Apr 09 '10 07:04

AwkwardCoder


People also ask

Does JSON have schema validation?

JSON Schema is a powerful tool. It enables you to validate your JSON structure and make sure it meets the required API. You can create a schema as complex and nested as you need, all you need are the requirements. You can add it to your code as an additional test or in run-time.

How does JSON Schema validation work?

JSON Schema Validation: The JSON Schema Validation specification is the document that defines the valid ways to define validation constraints. This document also defines a set of keywords that can be used to specify validations for a JSON API. In the examples that follow, we'll be using some of these keywords.

How do I check if a JSON is invalid?

JSONLint is a validator and reformatter for JSON, a lightweight data-interchange format. Copy and paste, directly type, or input a URL in the editor above and let JSONLint tidy and validate your messy JSON code.

How do I check schema validation?

The Schema Validation filter can be found under the "Content Filtering" category of filters in the Policy Studio. Drag and drop the filter onto the policy where you want to perform schema validation. The Schema Validation filter dialog has 3 tabs, each of which will be explained in the following sections.


2 Answers

A free and open-source alternative to Json.NET is NJsonSchema (JSON Schema draft 4).

like image 82
Rico Suter Avatar answered Oct 09 '22 18:10

Rico Suter


Json.NET has this functionality.

like image 28
Darin Dimitrov Avatar answered Oct 09 '22 19:10

Darin Dimitrov