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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file haokjsonapi-0.1.1.tar.gz.
File metadata
- Download URL: haokjsonapi-0.1.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081c626cab23dad42e7fe30e927d2ea18237269ac4f4943093dfbdd08466a75b
|
|
| MD5 |
37f9dd43fc70f2fb47376fb9de127aba
|
|
| BLAKE2b-256 |
9d98f3d863ff86554f75dea0c8d0969d2d280aa174f6df74cd93e60f68238593
|
File details
Details for the file haokjsonapi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: haokjsonapi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
131acc9ac2291ad26db48beff76b9e4758eff4ad01b1d2d3f435ace02aaa764f
|
|
| MD5 |
d4eaa8d3476d7fe895b2f679ad5e2c7f
|
|
| BLAKE2b-256 |
81936c731f807436f8174573ae9c2bc390445080a7b32d268c34545d7d5068d5
|