j_classify
Improved JSON deserializer for Python that allows for remapping to custom object types and nested objects. This allows for saving/loading complex Python objects, like using pickle while still preserving them in a human-readable format.
Installation
pip install j_classify
Usage
import json
import j_classify
class test_class_1(j_classify.j_object):
def __init__(self) -> None:
super().__init__()
self.name = "test_class_1"
self.number = 1
self.boolean = True
self.children: list = []
class test_class_2(j_classify.j_object):
def __init__(self) -> None:
super().__init__()
self.name = "test_class_2"
self.number = 2
self.boolean = False
self.children: list = []
class test_class_3(j_classify.j_object):
def __init__(self) -> None:
super().__init__()
self.name = "test_class_3"
self.number = 3
self.boolean = True
if __name__ == "__main__":
obj_1 = test_class_1()
obj_1.name = "obj_1"
obj_1.number = 2
obj_1.boolean = False
obj_2 = test_class_2()
obj_2.name = "obj_2"
obj_2.number = 3
obj_2.boolean = True
obj_1.children.append(obj_2)
obj_3 = test_class_3()
obj_3.name = "obj_3"
obj_3.number = 4
obj_3.boolean = False
obj_2.children.append(obj_3)
# Dump the object to JSON - use the j_object_encoder class for the cls argument
obj_data = json.dumps(obj_1, cls=j_classify.j_object_encoder, indent=4)
# Load the object from JSON - use the load_j_object function for the object_hook
loaded_obj_1 = json.loads(obj_data, object_hook=j_classify.load_j_object)
Metadata
Release files for j-classify 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| j_classify-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for j_classify-1.0.0-py3-none-any.whl |
Release files / j_classify-1.0.0-py3-none-any.whl
| Download URL | j_classify-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae9660ff4474727c73e2a8b3f4f38d00914bcfc90aa914d92505cab5f700a92e
|
|
BLAKE2b-256 checksum How to use checksums |
810145e8695155a8c2b11f5b41c7a4722f0468c03c5787665b1d20699d0e7a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for j-classify 1.0.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.