Strongly typed JSON (un)marshal library
Project description
Strongly typed (un)marshaller between Python object and JSON inspired by Golang’s “encode/json” library.
Short example
Here is a pitch for TypedMarshal.
Let there be a JSON model definition:
from typedmarshal import MarshalModel class SampleModel(MarshalModel): name: str = None age: int = None hobbies: List[str] = []
Then unmarshal JSON:
js_str = ''' { "name": "Hatsune Miku", "age": 16, "hobbies": ["Sing a song", "Dance to music", "Eat negi"] } ''' js_obj = SampleModel() js_obj.load_json(js_str)
Now defined attributes are available to use:
>>> js_obj.name 'Hatsune Miku' >>> js_obj.hobbies ['Sing a song', 'Dance to music', 'Eat negi']
Voila!
Development progress
It’s still in alpha and unstable. Everything may change in future.
Contributing
TBD
License
This library is released under BSD License.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for typedmarshal-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b53322bf045caf1a5d2c5487ff370dacc7e04183b8332075afad49f97a461ff |
|
MD5 | cbee79c2c0fa5c946aca5a7bda24a16f |
|
BLAKE2b-256 | eda85e5ef313aad21bdea736a39faaee1fe52b65a1865947bfbfbf8afbb003ef |