**# JSONEyeX: Effortless JSON Data Validation in Python**
**JSONEyeX** is a robust and user-friendly Python package that streamlines the process of validating JSON data against predefined schemas. Whether you're building web APIs, managing data pipelines, or developing in JSON-heavy environments, **JSONEyeX** ensures your data adheres to the specified format and types, enhancing the reliability and efficiency of your projects.
**Key Features:**
* **Comprehensive validation:** Handles various data types, nested structures, and custom validations.
* **Clear error messages:** Simplifies debugging with informative and descriptive feedback.
* **Seamless integration:** Easily integrates into existing Python projects.
**Ideal Use Cases:**
* **Data cleansing and verification in web APIs.**
* **Ensuring data integrity in data pipelines and processing tasks.**
* **Rapid development in projects with extensive JSON data usage.**
**Get Started with JSONEyeX:**
1. Install `JSONEyeX` using `pip install JSONEyeX`.
2. Define your JSON schema using Python dictionaries.
3. Validate your data against the schema with `jsonvalidator` function.
**Example 1: Validating a Simple JSON Object:**
```python
schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "number"},
"address": {
"type": "object",
"properties": {
"street": {"type": "string"},
"city": {"type": "string"}
},
"required": ["street", "city"]
}
},
"required": ["name", "age", "address"]
}
data = {
"name": "John Doe",
"age": 30,
"address": {
"street": "123 Main St",
"city": "Anytown"
}
}
from JSONEyeX import jsonvalidator
try:
validator = jsonvalidator(schema, data)
print("Validation successful! Your data conforms to the expected format.")
except ValueError as e:
print(f"Validation error: {e}")
```
**Example 2: Handling Unknown Properties in Nested Objects**
While defining nested JSON objects in your schema, sometimes you might not know or need to specify every possible property. **JSONEyeX** allows you to handle these **unknown properties** gracefully. Consider the "material_grade" object in our example schema. It has an empty "properties" list, indicating that any additional properties beyond "manufacturing_process" will be accepted without validation. However, note that the "material_grade" object itself is still required through the schema's "required" field.
```python
schema = {
"type": "object",
"properties": {
"tolerance": {"type": "string"},
"quantity": {"type": "number"},
"surface_finish": {"type": "string"},
"material_grade": {
"type": "object",
"properties": {},
"required": [] # No specific properties required, but object itself is mandatory
},
"material_group": {
"type": "object",
"properties": {
"data": {"type": "string"}
},
"required": ["data"]
}
},
"required": [
"tolerance",
"quantity",
"surface_finish",
"material_grade"
]
}
data = {
"tolerance": "0.1mm",
"quantity": 100,
"surface_finish": "matte",
"material_grade": {"manufacturing_process": "3D printing", "additional_property": "value"},
"material_group": {"data": "Sample material group data"}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/venkatasidhartha/JSONEyeX.git",
"name": "JSONEyeX",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,json,validation,json-validator",
"author": "venkata sidhartha (sidhu)",
"author_email": "venkatasidhartha@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ff/66/2ea079deaa18abe57ec60bcc3605043aa10d61e4b82a668a93f004f9d124/JSONEyeX-0.0.10.tar.gz",
"platform": null,
"description": "\n\n**# JSONEyeX: Effortless JSON Data Validation in Python**\n\n**JSONEyeX** is a robust and user-friendly Python package that streamlines the process of validating JSON data against predefined schemas. Whether you're building web APIs, managing data pipelines, or developing in JSON-heavy environments, **JSONEyeX** ensures your data adheres to the specified format and types, enhancing the reliability and efficiency of your projects.\n\n**Key Features:**\n\n* **Comprehensive validation:** Handles various data types, nested structures, and custom validations.\n* **Clear error messages:** Simplifies debugging with informative and descriptive feedback.\n* **Seamless integration:** Easily integrates into existing Python projects.\n\n**Ideal Use Cases:**\n\n* **Data cleansing and verification in web APIs.**\n* **Ensuring data integrity in data pipelines and processing tasks.**\n* **Rapid development in projects with extensive JSON data usage.**\n\n**Get Started with JSONEyeX:**\n\n1. Install `JSONEyeX` using `pip install JSONEyeX`.\n2. Define your JSON schema using Python dictionaries.\n3. Validate your data against the schema with `jsonvalidator` function.\n\n**Example 1: Validating a Simple JSON Object:**\n\n```python\nschema = {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"number\"},\n \"address\": {\n \"type\": \"object\",\n \"properties\": {\n \"street\": {\"type\": \"string\"},\n \"city\": {\"type\": \"string\"}\n },\n \"required\": [\"street\", \"city\"]\n }\n },\n \"required\": [\"name\", \"age\", \"address\"]\n}\n\ndata = {\n \"name\": \"John Doe\",\n \"age\": 30,\n \"address\": {\n \"street\": \"123 Main St\",\n \"city\": \"Anytown\"\n }\n}\n\nfrom JSONEyeX import jsonvalidator\n\ntry:\n validator = jsonvalidator(schema, data)\n print(\"Validation successful! Your data conforms to the expected format.\")\nexcept ValueError as e:\n print(f\"Validation error: {e}\")\n```\n\n\n**Example 2: Handling Unknown Properties in Nested Objects**\n\nWhile defining nested JSON objects in your schema, sometimes you might not know or need to specify every possible property. **JSONEyeX** allows you to handle these **unknown properties** gracefully. Consider the \"material_grade\" object in our example schema. It has an empty \"properties\" list, indicating that any additional properties beyond \"manufacturing_process\" will be accepted without validation. However, note that the \"material_grade\" object itself is still required through the schema's \"required\" field.\n\n```python\nschema = {\n \"type\": \"object\",\n \"properties\": {\n \"tolerance\": {\"type\": \"string\"},\n \"quantity\": {\"type\": \"number\"},\n \"surface_finish\": {\"type\": \"string\"},\n \"material_grade\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": [] # No specific properties required, but object itself is mandatory\n },\n \"material_group\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\"type\": \"string\"}\n },\n \"required\": [\"data\"]\n }\n },\n \"required\": [\n \"tolerance\",\n \"quantity\",\n \"surface_finish\",\n \"material_grade\"\n ]\n}\n\ndata = {\n \"tolerance\": \"0.1mm\",\n \"quantity\": 100,\n \"surface_finish\": \"matte\",\n \"material_grade\": {\"manufacturing_process\": \"3D printing\", \"additional_property\": \"value\"},\n \"material_group\": {\"data\": \"Sample material group data\"}\n}\n```\n\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A lightweight and efficient JSON validation tool for Python.",
"version": "0.0.10",
"project_urls": {
"Homepage": "https://github.com/venkatasidhartha/JSONEyeX.git"
},
"split_keywords": [
"python",
"json",
"validation",
"json-validator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5e9bbe459557c655575754b754ae3dd6cfcf364661acadf8669ec1e99c1f1110",
"md5": "a2a9a7d4e4de97bbdec2a6ef72a6612b",
"sha256": "6aa745d88294d103f81f1824dec3b202cc78222081cc911199cc6f656732f146"
},
"downloads": -1,
"filename": "JSONEyeX-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2a9a7d4e4de97bbdec2a6ef72a6612b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3747,
"upload_time": "2023-12-19T12:10:14",
"upload_time_iso_8601": "2023-12-19T12:10:14.228602Z",
"url": "https://files.pythonhosted.org/packages/5e/9b/be459557c655575754b754ae3dd6cfcf364661acadf8669ec1e99c1f1110/JSONEyeX-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff662ea079deaa18abe57ec60bcc3605043aa10d61e4b82a668a93f004f9d124",
"md5": "4e5d8d499ca19820875f6a0effa0f682",
"sha256": "82bc6eff9030afae8c384d61de41c71bebfb1eca62135fbfdb8baea9c190f48d"
},
"downloads": -1,
"filename": "JSONEyeX-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "4e5d8d499ca19820875f6a0effa0f682",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3491,
"upload_time": "2023-12-19T12:10:16",
"upload_time_iso_8601": "2023-12-19T12:10:16.048154Z",
"url": "https://files.pythonhosted.org/packages/ff/66/2ea079deaa18abe57ec60bcc3605043aa10d61e4b82a668a93f004f9d124/JSONEyeX-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-19 12:10:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "venkatasidhartha",
"github_project": "JSONEyeX",
"github_not_found": true,
"lcname": "jsoneyex"
}