Automatic custom class JSON serialization and deserialization
Project description
Jsonty is an automatic JSON serialization/deseralization Python library for your custom classes.
How it works
Jsonty serialize and deserialize your custom objects by its annotations. All you have to do is define its attributes and make sure that are added in the constructor
import jsonty
class Toy(jsonty.Model):
name: str
uses: int
def __init__(self, name: str, uses: int):
self.name = name
self.uses = uses
# Object creation
toy: Toy = Toy(name='white car', uses=10)
# Dumps operation
toy_json: str = toy.dumps() # { 'name': 'white car', 'uses': 10 }
# Loads operation
toy_recoverying: Toy = Toy.loads(toy_json) # The json representation is converted into a Toy object
Operations supported
- There are a range of types that jsonty can handle such as:
Basic data types: str, int, bool, number
Iterables: List, Dict, Set, Tuple
Model Inheritance
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 jsonty-0.2.0-py3-none-any.whl.
File metadata
- Download URL: jsonty-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ab7a07ffd7515b1eed039cb6b44d180d6229f1636aed111037daf6742091ec0
|
|
| MD5 |
8dccdcc9ff40f4c5a8479a8e7f06e2e3
|
|
| BLAKE2b-256 |
ffa2a6df0a906f93dd70354b68820c9da351b7c8b823f74bf7c99903ed44da0b
|