Skip to main content

cf-json

Expanded JSON serialization


Summary

cf-json provides a batteries included approach to extending the standard json module.

It achieves this by making use of a custom json.JSONEncoder subclass cfjson.MyEncoder to expand the range of types that can be serialized. While keeping sticking to the json interface.

Installation

Install the package from PyPI:

$ python -m pip install cf-json
[...]
Successfully installed cf-json

Quick Start

cf-json is a drop in replacement for the standard json module.

>>> from cfjson import dumps, loads
>>> data = {1: 'a', 2: Path('./my_file.py'), 3: datetime.datetime.utcnow()}
>>> data
{1: 'a', 2: WindowsPath('my_file.py'), 3: datetime.datetime(2021, 4, 7, 2, 45, 57, 696066)}
>>> json_blob = dumps(data)
>>> json_blob
'{"1": "a", "2": {"__json_type__": "WindowsPath", "path": "my_file.py"}, "3": {"__json_type__": "datetime", "datetime": "2021-04-07T02:45:57.696066"}}'
>>> loads(json_blob)
{'1': 'a', '2': WindowsPath('my_file.py'), '3': datetime.datetime(2021, 4, 7, 2, 45, 57, 696066)}

Documentation

Full documentation

Metadata

Release files for cf-json 0.1.0

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

Source distribution (sdist)

Source distribution for cf-json 0.1.0
File Size Uploaded Provenance Actions
cf-json-0.1.0.tar.gz 9.2 MB Without provenance Details for cf-json-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cf-json 0.1.0
File Interpreter ABI Platform Actions
cf_json-0.1.0-py3-none-any.whl Python 3 none any Details for cf_json-0.1.0-py3-none-any.whl

Total release size: 9.2 MB

Release files / cf-json-0.1.0.tar.gz

Download URL cf-json-0.1.0.tar.gz
Size 9.2 MB
Tags Source
SHA-256 checksum
How to use checksums
9cc0aefae5904f4cfd11a32b48b693f70c5d04fd804643c78c0dd94dc4974d5c
BLAKE2b-256 checksum
How to use checksums
110bdb101ea9eafb9b67b62b06c927e6eccb8eabb765a47b487e64c5d6b16cb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.8.9 Linux/5.10.21-Unraid

Release files / cf_json-0.1.0-py3-none-any.whl

Download URL cf_json-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d35ed503a27844cdb4469ab64988ae65de6509a602be3002643d2ee31bcc96d6
BLAKE2b-256 checksum
How to use checksums
61432e6c8901a6bf09eef8a6a660bd3d24033f9dd7bd3b02f56930e0d96ee6bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.8.9 Linux/5.10.21-Unraid

Security for cf-json 0.1.0

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.

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