SDJS is a tool that validates JSON members matched with the descriptions of data presence, type, and constraint.
SDJS includes a group of rules and notations which describe data presence, data type and data constraints to a JSON data, the rules and notations don't change any key-value pairs in JSON, they are some extra members to JSON.
SDJS-Web is a version of SDJS specified for web browsers. To access SDJS-Web repository for the details.
The URL of SDJS-Web CDN is https://cdn.jsdelivr.net/gh/w3plan/sdjs-web/
To see Self Description JSON Schema
Downloads sdjs-web from sdjs-web repository to the directory of web server, or includes sdjs.js via CDN with https://cdn.jsdelivr.net/gh/w3plan/sdjs-web@master/sdjs.js in web pages.
Adding <script src="https://cdn.jsdelivr.net/gh/w3plan/sdjs-web@master/sdjs.js"></script> or <script src="/directory-to-sdjs/sdjs.js"></script> to web pages then doing data validation:
// supposing that sdjsObj is a JSON object with Self Description JSON Schema
if ( sdjs.valiSdjs(sdjsObj) ) {
console.log("validation succeeded.");
} else {
console.log("validation failed.");
}
Accessing /test/index.html from web server.
MIT
presence, type, constraint, schema, sdjs, sdjs-web, json