{"repo":"henriquebastos/python-jsonstar","free":true,"listed":false,"github":"https://github.com/henriquebastos/python-jsonstar","clone":"git clone https://github.com/henriquebastos/python-jsonstar.git","description":"Extensible JSON module to serialize all objects.","language":"Python","stars":28,"topics":["api-client","json","python","serialization"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"JSON is an extensible json module to serialize all objects! jsonstar extends Python's standard JSON encoder and decoder to easily handle your custom types. This means you won't have to transform your custom types into dictionaries with primitive types before encoding them to JSON. And you won't have to parse back the encoded strings into your custom types after decoding them from JSON. How to install it? How to start using it? The jsonstar module provides the same API as the standard json module, so you can use it as a drop in replacement. Simply change your import from import json to import jsonstar as json and you're good to go. Why use it? Consider you have a pydantic Employee class that you want to serialize to JSON. The standard json module can't serialize the employee instance, requiring you to call its dict method. This will not suffice, because the standard json module don't know how to encode Decimal , date and set . Your solution would include some transfomation of the employee instance and its attributes before encoding it to JSON. That is where jsonstar shines by providing default encoder for common types like pydantic.BaseModel , decimal.Decimal , datetime.date and set . And allowing you to easily add your own encoders. What default encoders are provided? By default, jsonstar provides encoders for the following types: - attrs classes - dataclasses.dataclass classes - datetime.date - datetime.datetime - datetime.time - datetime.timedelta - decimal.Decimal - frozen","default_branch":null,"files":null,"tree":[],"storefront":"/r/henriquebastos","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/henriquebastos/python-jsonstar/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}