Skip to main content

Library for easy converting between plain JSON-like data and compound structure of user defined class instances.

Project description

Library for easy bi-direction converting between plain JSON-like data (numbers, strings, lists and dicts) and compound user-defined classes.

Trivial example:

>>> from steward import *
>>> class Comp(Component):
...     a = Field()
...     b = Field(default=1)
...
>>> v = Comp(a=0)
>>> dct = v.as_plain()
>>> dct
{'a': 0, 'b': 1}
>>> v2 = Comp.from_plain(dct)
>>> v2.a
0
>>> v2.b
1
>>> v2.a = 7
>>> v2.as_plain()
{'a': 7, 'b': 1}

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

steward-0.0.4.tar.gz (3.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page