json-validation-al


Namejson-validation-al JSON
Version 0.0.9 PyPI version JSON
download
home_pageNone
SummaryA wrapper package for the jsonschema library to validate JSON data against a schema.
upload_time2024-07-16 12:34:33
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseCopyright (c) 2016 The Python Packaging Authority (PyPA) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords json jsonschema schema validate validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```shell
pip install json-validation
```

## Usage

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

```python
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:

```python
validator = Validator(schema)
```

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

```python
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:

```python
# 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](LICENSE) file for more information.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "json-validation-al",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Tiaan Nieuwoudt <tiaan@al.co.za>",
    "keywords": "json, jsonschema, schema, validate, validation",
    "author": null,
    "author_email": "Tiaan Nieuwoudt <tiaan@al.co.za>",
    "download_url": "https://files.pythonhosted.org/packages/4c/7f/35c79d3ae39308ddaaaa7a06275fe2c741dfaa7a1ad786d254ac003adf99/json_validation_al-0.0.9.tar.gz",
    "platform": null,
    "description": "# JSON Validation\n\nThis 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.\n\n## Installation\n\nYou can install JSON Validation using pip:\n\n```shell\npip install json-validation\n```\n\n## Usage\n\nTo use JSON Validation in your Python code, you first need to import the `Validator` class:\n\n```python\nfrom json_validation import Validator\n```\n\nNext, you can create an instance of the `Validator` class and specify the JSON schema you want to validate against:\n\n```python\nvalidator = Validator(schema)\n```\n\nYou can then use the `validate` method to validate your JSON data:\n\n```python\nresult = validator.validate(data)\n```\n\nThe `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.\n\n## Examples\n\nHere are some examples to help you get started:\n\n```python\n# Create a schema\nschema = {\n    \"type\": \"object\",\n    \"properties\": {\n        \"name\": {\"type\": \"string\"},\n        \"age\": {\"type\": \"number\"}\n    },\n    \"required\": [\"name\"]\n}\n\n# Create a Validator instance\nvalidator = Validator(schema)\n\n# Validate JSON data\ndata = {\n    \"name\": \"John\",\n    \"age\": 30\n}\nresult = validator.validate(data)\n\nif result:\n    print(\"Data is valid!\")\nelse:\n    print(\"Data is invalid.\")\n    print(validator.errors)\n```\n\n## Contributing\n\nContributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on the GitHub repository.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2016 The Python Packaging Authority (PyPA)  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A wrapper package for the jsonschema library to validate JSON data against a schema.",
    "version": "0.0.9",
    "project_urls": null,
    "split_keywords": [
        "json",
        " jsonschema",
        " schema",
        " validate",
        " validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fc239c439be5ba440db1113475f1b1b3b1dccb50d4615652931cd63603450a7",
                "md5": "1f4d7024e706bc25dc83e859cd932eed",
                "sha256": "83a44b2066dc806625315f346b62288d2072def35eafdefa6ddb37e53a2450b4"
            },
            "downloads": -1,
            "filename": "json_validation_al-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f4d7024e706bc25dc83e859cd932eed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5732,
            "upload_time": "2024-07-16T12:34:32",
            "upload_time_iso_8601": "2024-07-16T12:34:32.178672Z",
            "url": "https://files.pythonhosted.org/packages/0f/c2/39c439be5ba440db1113475f1b1b3b1dccb50d4615652931cd63603450a7/json_validation_al-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c7f35c79d3ae39308ddaaaa7a06275fe2c741dfaa7a1ad786d254ac003adf99",
                "md5": "1c87ad3f8e2f97543cc7e62c85ef82dd",
                "sha256": "030d914041cb239b15d1877c518ae097854046ff9deb6424f2d3f83edf73c623"
            },
            "downloads": -1,
            "filename": "json_validation_al-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "1c87ad3f8e2f97543cc7e62c85ef82dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3705,
            "upload_time": "2024-07-16T12:34:33",
            "upload_time_iso_8601": "2024-07-16T12:34:33.363459Z",
            "url": "https://files.pythonhosted.org/packages/4c/7f/35c79d3ae39308ddaaaa7a06275fe2c741dfaa7a1ad786d254ac003adf99/json_validation_al-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-16 12:34:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "json-validation-al"
}
        
Elapsed time: 0.30086s