Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON schema validation

Is there a stable library that can validate JSON against a schema?

json-schema.org provides a list of implementations. Notably C and C++ are missing.

Is there a reason I can't easily find a C++ JSON schema validator?
Doesn't anyone else want a quick way to validate incoming JSON files?

like image 816
deft_code Avatar asked Jan 13 '11 02:01

deft_code


People also ask

How do I check if a JSON Schema is valid?

The simplest way to check if JSON is valid is to load the JSON into a JObject or JArray and then use the IsValid(JToken, JsonSchema) method with the JSON Schema. To get validation error messages, use the IsValid(JToken, JsonSchema, IList<String> ) or Validate(JToken, JsonSchema, ValidationEventHandler) overloads.

How do you validate a schema?

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.

Why do we validate JSON Schema?

When we validate a JSON document without its Schema, we are validating only the syntax of the document. Syntactic validation guarantees only that the document is well-formed. The tools such as JSONLint, and the JSON parsers perform only Syntactic validations.

What is JSON Schema validation in Java?

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.


1 Answers

Is there a stable library that can validate JSON against a schema?

I found a couple hits on google:

  • From the Chromium project: http://aaronboodman-com-v1.blogspot.com/2010/11/c-version-of-json-schema.html
  • http://avro.apache.org/docs/1.4.1/api/cpp/html/index.html

You could also plug a Python or Javascript interpreter into your app, and simply run the native version of those validator implementations that you've already found.

Is there a reason I can't easily find a C++ JSON schema validator?

I believe JSON originated as a web technology, and C/C++ has fallen out of favor for web app implementation.

like image 142
Merlyn Morgan-Graham Avatar answered Sep 28 '22 10:09

Merlyn Morgan-Graham