Pre-release
This release is a pre-release and may not be stable for production use.
This library implements several JSON specs, like JSON Schema, JSON Reference and JSON Pointer:
It works on python 2.7, python 3.3 and above
It is release under the BSD license
Installation
This library has no special dependencies. You can simply use pip:
$ pip install json-extensions
Usage
Let say you want to fetch / validate JSON like objects.
You can extract member of an object with JSON Pointer:
from json.pointer import extract
obj = {
'foo': ['bar', 'baz', 'quux']
}
assert 'baz' == extract(obj, '/foo/1')
You can resolve member of any object with JSON Reference:
from json.reference import resolve
obj = {
'foo': ['bar', 'baz', {
'$ref': '#/sub'
}],
'sub': 'quux'
}
assert 'quux' == resolve(obj, '#/foo/2')
You can describe you data with JSON Schema:
from json.schema import load
# data will validate against this schema
validator = load({
'title': 'Example Schema',
'type': 'object',
'properties': {
'age': {
'description': 'Age in years',
'minimum': 0,
'type': 'integer'
},
'firstName': {
'type': 'string'
},
'lastName': {
'type': 'string'
}
},
'required': [
'firstName',
'lastName'
]
})
# validate this data
validator.validate({
'firstName': 'John',
'lastName': 'Noone',
'age': 33,
})
Other examples can be found in the documentation or in the tests.
Metadata
Release files for json-extensions 0.2.1.9.g9d1a9cb
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json-extensions-0.2.1.9.g9d1a9cb.tar.gz | 27.7 kB | Details |
Release files / json-extensions-0.2.1.9.g9d1a9cb.tar.gz
| Download URL | json-extensions-0.2.1.9.g9d1a9cb.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
931189b7682c2454b17cdfcaf72fa4ef96d210d3664095f7143de5512b5ee933
|
|
BLAKE2b-256 checksum How to use checksums |
d70b4ef1940cc2672d43f5a0034a6661698fd357612d9cfcfb12611048b0dfa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |