To convert a JSON string to a dictionary using json.loads(). This method accepts a valid json string and returns a dictionary in which you can access all elements. For example,
>>> import json >>> s = '{"success": "true", "status": 200, "message": "Hello"}' >>> d = json.loads(s) >>> print d["success"], d["status"] true 200
If you have a json file instead and want to construct a dict out of it, you can use the json.load() method.