Skip to main content

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.

Metadata

Release files for typedmarshal 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for typedmarshal 0.0.1
File Interpreter ABI Platform
typedmarshal-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / typedmarshal-0.0.1-py3-none-any.whl

Download URL typedmarshal-0.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b53322bf045caf1a5d2c5487ff370dacc7e04183b8332075afad49f97a461ff
BLAKE2b-256 checksum
How to use checksums
eda85e5ef313aad21bdea736a39faaee1fe52b65a1865947bfbfbf8afbb003ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for typedmarshal 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page