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 | Description |
---|---|---|
equals | * | Check if value matches |
iequals | string | Check if value matches (case insensitive) |
nequals | * | Check if value does not match |
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
File details
Details for the file json_schema_filter-0.3.0.tar.gz
.
File metadata
- Download URL: json_schema_filter-0.3.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.0 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b56727f35907299b486f5f0f00db7b4a718d962df8f6ab570a36c7055aca67b8 |
|
MD5 | 8a7e5ffadcef18b9e2f311e589303896 |
|
BLAKE2b-256 | f66de7a916fa8331c4c4cb298ee429fecdc071c128ad6a090740abc808d716f0 |
File details
Details for the file json_schema_filter-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: json_schema_filter-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.0 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d96db69b20fea840e23d1b005a9e564bcf0627cef333ccca95b10f612480358f |
|
MD5 | 1eca6052b3bb861d3897f48fd1b23711 |
|
BLAKE2b-256 | 4453948a76012a99feeb42afbaf66d2264c34b9b7cfdbc749f476930de17c082 |