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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for haokjsonapi-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 131acc9ac2291ad26db48beff76b9e4758eff4ad01b1d2d3f435ace02aaa764f |
|
MD5 | d4eaa8d3476d7fe895b2f679ad5e2c7f |
|
BLAKE2b-256 | 81936c731f807436f8174573ae9c2bc390445080a7b32d268c34545d7d5068d5 |