Skip to main content

No project description provided

Project description

haokjsonapi

haokjsonapi is a Python package that extends the built-in json library to support complex and range objects in JSON serialization and deserialization.

Installation

You can install haokjsonapi using pip:

pip install haokjsonapi

Usage

Serializing Complex Objects

haokjsonapi allows you to serialize complex and range objects to JSON easily. To use it, import the haokjsonapi module and use the dumps function:

import haokjsonapi

data = complex(1, 2)

json_str = haokjsonapi.dumps(data)

Deserializing Complex Objects

You can also deserialize JSON data containing complex and range objects back into Python objects using haokjsonapi. Use the loads function:

import haokjsonapi

json_str = '{"hey": {"real": 1.0, "imag": 2.0, "__extended_json_type__": "complex"}, "there": {"start": 1, "stop": 10, "step": 3, "__extended_json_type__": "range"}, "73": false}'
data = haokjsonapi.loads(json_str)

License

This package is distributed under the MIT License. See the LICENSE file for more details.

Acknowledgments

We would like to thank the Python community and the creators of the json library for their valuable contributions.

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

haokjsonapi-0.1.0.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

haokjsonapi-0.1.0-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

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