A library that uses json schema to filter the objects
Project description
json-schema-filter
A library that uses jsonschema
to filter the objects
Usage
from json_schema_filter import JsonSchemaFilter
schema = {
"properties": {
"name": {
"type": "string",
"equals": "Shakespeare"
}
},
"required": ["name"]
}
input_data = [
{"name": "what is in the name"},
{"name": "Shakespeare"},
{"name": "hamlet"},
]
print(JsonSchemaFilter(schema).filter(input_data))
# output
"""
Total Selected: 1
Filtered Item: [0]
1. name: Values not equal. Expected: Shakespeare, Found: what is in the name
Filtered Item: [2]
1. name: Values not equal. Expected: Shakespeare, Found: hamlet
"""
Supported additional properties
Property | Supported type |
---|---|
equals | * |
iequals | string |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for json_schema_filter-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dfb72e258c2d07fcda7663d922eaa7651910aea1c587b4deb0e1e60ddc7336b |
|
MD5 | c4c4cd18ec9c13dc712a81bd54e7d11a |
|
BLAKE2b-256 | d52c7158dd553e90d3c26c5c411fe5d1320de4d14287b46b397cf93c86a292d4 |