Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 25, 2024 via pnpm

json-schema 0.4.0

JSON Schema validation and specifications
Package summary
Share
0
issues
1
license
1
(AFL-2.1 OR BSD-3-Clause)
Package created
6 Jul 2012
Version published
9 Nov 2021
Maintainers
1
Total deps
1
Direct deps
0
License
(AFL-2.1 OR BSD-3-Clause)

Issues

0
This package has no issues

Licenses

(AFL-2.1 OR BSD-3-Clause)

Permissive
1 Packages, Including:
json-schema@0.4.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of json-schema 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does json-schema do?

JSON Schema is an efficient and lightweight implementation of the original core elements of JSON schema validation and specifications. It encompasses the earlier draft specification of JSON Schema, and is considered "finished", aiming to maintain stability both in behavior and size. This allows for the creation, validation, and description of data structures for JavaScript Object Notation (JSON) data formats. Keep in mind, this package doesn't include the latest specifications or implement the latest versions of JSON Schema.

How do you use json-schema?

Incorporating JSON Schema into your JavaScript project starts with installing it via npm using the command npm install json-schema. Following installation, you can require the package in your code and use it to validate JSON data against a particular schema.

Here is a simple usage example:

var Validator = require('json-schema').Validator;
var v = new Validator();

// defining a schema
var schema = {
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "integer" }
  },
  "required": ["name"]
};

// defining data
var data = {
  "name": "John",
  "age": 30
};

// validation
var validation = v.validate(data, schema);
if (validation.valid) {
  console.log('Valid!');
} else {
  console.log('Invalid: ' + validation.errors.join(', '));
}

In this example, we define a JSON schema for an object with a string property 'name' and an integer property 'age'. 'Name' is required. The v.validate(data, schema) function is then used to validate a data object against the defined schema.

Where are the json-schema docs?

The key documentation for this package is sadly not housed in this repository. Therefore, for the most recent JSON schema specifications and implementations, you should visit the official JSON Schema site. Furthermore, the latest repository can be found on GitHub at https://github.com/json-schema-org/json-schema-spec where you can access more up-to-date information and developments for JSON Schema.