The library for serialize/deserialize into format JSON.
Project description
Package json_serializer
The library for serialize/deserialize into format JSON.
How use it?
For example you have class that needed serialize or deserialize.
class Car(object):
mark = None
model = None
year = None
color = None
Create object
car = Car()
car.mark = 'Ford'
car.model = 'Mustang'
car.year = 2016
car.color = 'Black'
Import class JsonSerializer and create object of serializer
In the constructor pass list of classes that will be involved in serialization/deserialization.
from json_serializer.Serializer import Serializer
...
serializer = Serializer([
Car
])
Serialization
string = serializer.serialize(car) # sting contains next json:
# {
# "mark": "Ford",
# "model": "Mustang",
# "year": 2016,
# "color": "Black"
# }
Deserialization
car = serializer.deserialize(string)
Variable car
type of Car
and contains values of all fields.
Enjoy!
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
json_serializer-1.0.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for json_serializer-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524b44444e834c463274f5c74dc145f8e2db7426dc193c632d04573c343c0424 |
|
MD5 | 25ec163a92cde25fa9d34660d51a3dc7 |
|
BLAKE2b-256 | 0d5d838e88b5e7e00e6522befe91821448d644a5c20e24784bb6a768dfb95791 |