This program is regarding the conversion of JSON to a dictionary in Python. It is a very simple code used in this, and users can understand it easily.
This program gives little awareness regarding the conversion of JSON to a Python dictionary. The conversion is very simple in manner.JSON stands for JavaScript Object Notation. The file JSON must be saved with an extension of .json. JSON file data is the same as a Python dictionary it contains key-value pair. It contains two functions json.load() and json.loads().
In this program, we are using json.loads() method. We can convert Python dictionary to JSON in this program we are converting JSON to Python dictionary. json.load() is used to load a JSON to a Python dictionary and a json.loads() is used to load a string of a JSON to a Python dictionary. The suffix s refers to string. First, we load the JSON library and a name:value pair is initialised and declared in it. Function json.loads() is used in this program to convert the JSON file into a Python dictionary. After, that the user can print their parameter to obtain a result present in the name:value pair (key-value pair) declared in it.
Submitted by YANIGANTI SUCHITRA (Suchitra)
Download packets of source code on Coders Packet
Comments