Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-validation-al

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-validation-al

A wrapper package for the jsonschema library to validate JSON data against a schema.

  • 0.0.9
  • PyPI
  • Socket score

Maintainers
1

JSON Validation

This Python package provides a simple and intuitive way to validate JSON data against a specified schema. It is designed to be easy to use and highly customizable.

Installation

You can install JSON Validation using pip:

pip install json-validation

Usage

To use JSON Validation in your Python code, you first need to import the Validator class:

from json_validation import Validator

Next, you can create an instance of the Validator class and specify the JSON schema you want to validate against:

validator = Validator(schema)

You can then use the validate method to validate your JSON data:

result = validator.validate(data)

The validate method returns a boolean value indicating whether the data is valid according to the schema. You can also access detailed validation errors using the errors property of the Validator instance.

Examples

Here are some examples to help you get started:

# Create a schema
schema = {
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "age": {"type": "number"}
    },
    "required": ["name"]
}

# Create a Validator instance
validator = Validator(schema)

# Validate JSON data
data = {
    "name": "John",
    "age": 30
}
result = validator.validate(data)

if result:
    print("Data is valid!")
else:
    print("Data is invalid.")
    print(validator.errors)

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc