Skip to main content

No project description provided

Project description

generic-json-encoders

A speedier version of the lilya encoders with more correct results and support for pydantic and msgspec. It uses under the hood orjson.

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install generic-json-encoders

Usage

import datetime
from decimal import Decimal
from generic_json_encoders import json_encode, simplify

test_obj = {
    "datetime": datetime.datetime.now(),
    "date": datetime.date.today(),
    "decimal": Decimal("0.3").
}

# get json byte string
print(json_encode(test_obj))
# get simplified json serializable object
print(json_encode(test_obj))

Integrating in lilya

Put somewhere in the init code of your application

from importlib import import_module
from contextlib import suppress

...
with suppress(ImportError):
    import_module("generic_json_encoders.lilya_monkey_patcher")
...

License

generic-json-encoders is distributed under the terms of the BSD license.

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

generic_json_encoders-0.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

generic_json_encoders-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file generic_json_encoders-0.0.1.tar.gz.

File metadata

File hashes

Hashes for generic_json_encoders-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ffee2865eb085cc89aa018352c795333e22fd059107129503ede5afa417f1363
MD5 6e5ac61ebbc1302df9995f9f1517898f
BLAKE2b-256 a3eb63825a8a8213f36cda758f7f6c43ddc763fae465df75ccd41969c26ef637

See more details on using hashes here.

File details

Details for the file generic_json_encoders-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for generic_json_encoders-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de51714b2676f2828aea7885a34a8eba40253219cb6a4a1808eba574c16c145d
MD5 2bacf945a4d89ff13f8bcbf43334d746
BLAKE2b-256 bf0750e798bc215522f5caec1b6134157fd94ec3dff5f2cf744cd1d29f7fccde

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page