Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Automatic custom class JSON serialization and deserialization

Project description

Jsonty is an automatic JSON serialization/deseralization Python library for your custom classes.

Build Status GitHub issues Coverage License

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): = 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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jsonty, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size jsonty-0.2.0-py3-none-any.whl (12.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page