Deserialize JSON to Object in Python Last Updated : 07 Jul, 2021 Comments Improve Suggest changes Like Article Like Report Let us see how to deserialize a JSON document into a Python object. Deserialization is the process of decoding the data that is in JSON format into native data type. In Python, deserialization decodes JSON data into a dictionary(data type in python).We will be using these methods of the json module to perform this task : loads() : to deserialize a JSON document to a Python object.load() : to deserialize a JSON formatted stream ( which supports reading from a file) to a Python object. Example 1 : Using the loads() function. Python3 # importing the module import json # creating the JSON data as a string data = '{"Name" : "Romy", "Gender" : "Female"}' print("Datatype before deserialization : " + str(type(data))) # deserializing the data data = json.loads(data) print("Datatype after deserialization : " + str(type(data))) Output : Datatype before deserialization : Datatype after deserialization : Example 2 : Using the load() function. We have to deserialize a file named file.json. Python3 # importing the module import json # opening the JSON file data = open('file.json',) print("Datatype before deserialization : " + str(type(data))) # deserializing the data data = json.load(data) print("Datatype after deserialization : " + str(type(data))) Output : Datatype before deserialization : Datatype after deserialization : Comment More infoAdvertise with us Next Article Deserialize JSON to Object in Python R romy421kumari Follow Improve Article Tags : Python Python-json Practice Tags : python Similar Reads Convert class object to JSON in Python In Python, class objects are used to organize complex information. To save or share this information, we need to convert it into a format like JSON, which is easy to read and write. Since class objects can't be saved directly as JSON, we first convert them into a dictionary (a data structure with ke 3 min read Convert Generator Object To JSON In Python JSON (JavaScript Object Notation) is a widely used data interchange format, and Python provides excellent support for working with JSON data. However, when it comes to converting generator objects to JSON, there are several methods to consider. In this article, we'll explore some commonly used metho 2 min read Flattening JSON objects in Python JSON(JavaScript Object Notation) is a data-interchange format that is human-readable text and is used to transmit data, especially between web applications and servers. The JSON files will be like nested dictionaries in Python. To convert a text file into JSON, there is a json module in Python. This 3 min read How to JSON decode in Python? When working with JSON data in Python, we often need to convert it into native Python objects. This process is known as decoding or deserializing. The json module in Python provides several functions to work with JSON data, and one of the essential tools is the json.JSONDecoder() method. This method 5 min read Convert Text file to JSON in Python JSON (JavaScript Object Notation) is a data-interchange format that is human-readable text and is used to transmit data, especially between web applications and servers. The JSON files will be like nested dictionaries in Python. To convert a text file into JSON, there is a json module in Python. Thi 4 min read Like