Posts

Showing posts from November, 2018

Python: JSON Serialization / DeSerialization

JaveScript Object Notation (JSON) has become the de-facto convention when passing data through Internet web services, primarily those using the Representational State Transfer (REST) APIs. Originally developed for JavaScript JSON is a simple, human readable format of key-value pairs that is now supported by all major languages and platforms. The following is a simple JSON containing the Name, Age and City of a person. {"name": "John Doe", "age": 35, "country": "US"} A popular way of transferring data is to serialize/de-serialize data objects using JSON functionality supported in the platform. For example, if we have the following class in Python: class dataClass: def __init__(self): self.name = "John Doe" self.age = 35 self.country = "US" The serialized version of this class in JSON is the one we gave earlier,: {"name": "John Doe", "age": 35,