Convert JSON to dictionary in Python
- json.load(): json.loads() function is present in python built-in ‘json’ module. This function is used to parse the JSON string.
Parameter: It takes JSON file as the parameter.
Return type: It returns the python dictionary object.
Example 1: Let’s suppose the JSON file looks like this:
We want to convert the content of this file to Python dictionary. Below is the implementation.
Example 2: Reading nested data
In the above JSON file, there is a nested dictionary in the first key people1. Below is the implementation of reading nested data.
Please Login to comment...