A XML, JSON,... decode library
Project description
PyDecoder
A XML, JSON,… decode library
Free software: BSD license
Documentation: https://pydecoder.readthedocs.io.
Features
Decode and validate values from XML and JSON.
Install
To install PyDecoder, run this command in your terminal:
$ pip install pydecoder
Example
>>> from pydecoder.fields import required, optional
>>> from pydecoder.json import to_int, to_string, decode
# Define data
>>> data = {'foo': 'Text', 'bar': 1}
# Describe data
>>> decoders = [
... required('foo', to_string),
... required('bar', to_int),
... optional('baz', to_int, -5),
... ]
# Decode/verify data
>>> decode(lambda x: x, decoders, data)
Result(status='Ok', value=['Text', 1, -5])
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2017-05-21)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydecoder-1.0.1.tar.gz
(16.3 kB
view hashes)
Built Distribution
Close
Hashes for pydecoder-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089b4b568fb1c7ad6b3b03440150f27c1be8aa5223e519c2527728308459fc9c |
|
MD5 | 267bd55fdf412fab1cf6c368f5624083 |
|
BLAKE2b-256 | f3cce72934c9a7874bc3caf345e4139f9c1c3effb942eaabe6ea338659fecd5a |