Skip to main content

json-deserializer

Attempts to deserialize objects into a format that json.dumps/json.loads can use.

  • Anything that is a Sequence, but not a str will be cast to a list.
  • All Mappings will be cast to dicts
  • Decimal to floats
  • Callable to string (will return Object.repr)
  • NamedTuple to dict

Usage Example

    >>> from json import dumps
    >>> from collections import UserDict
    >>> from json_deserializer import deserialize
    >>>
    >>> class MyDict(UserDict):
    >>>     pass
    >>>
    >>> d = MyDict({"foo": "bar"})
    >>> try:
    >>>    dumps(d)
    >>> except Exception as e:
    >>>    print(e)
    Object of type MyDict is not JSON serializable
    >>> dumps(d, default=deserialize)
    '{"foo": "bar"}'

You can also import dump, load, dumps, and loads directly from json_deserializer which will call json.loads, json.dumps with default=json_deserializer.deserialize.

Metadata

Release files for json-deserializer 0.0.7

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

Source distribution (sdist)

Source distribution for json-deserializer 0.0.7
File Size Uploaded
json-deserializer-0.0.7.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-deserializer 0.0.7
File Interpreter ABI Platform
json_deserializer-0.0.7-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.8 kB

Release files / json-deserializer-0.0.7.tar.gz

Download URL json-deserializer-0.0.7.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b3180717cdecfc73d7c048447f45e21edd9f64a22f888a567021e1f3ee4fe92f
BLAKE2b-256 checksum
How to use checksums
f764158f40921c8b2ce2464b7c69ef0e23cc99e89b7d9704add4dbc49d70023e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11

Release files / json_deserializer-0.0.7-py2.py3-none-any.whl

Download URL json_deserializer-0.0.7-py2.py3-none-any.whl
Size 7.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
11cb3dfa15bce460a12c7f242c407e9514100379db10acfb36e814a4ec134d0c
BLAKE2b-256 checksum
How to use checksums
fafc1bc83dbfc5ef398935cdb58bc0545b06af5078f16a3cec2ba7f1949672a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

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