How to convert JSON string to dict using Python?

Sometimes, we want to convert JSON string to dict using Python.

In this article, we’ll look at how to convert JSON string to dict using Python.

How to convert JSON string to dict using Python?

To convert JSON string to dict using Python, we can use the json.loads method.

For instance, we write

import json

# ...

d = json.loads(j)
print(d['glossary']['title'])

to load the j JSON string into a dict with the json.loads method and assign the returned dict to d.

Then we can get the value we’re looking for from the dict d.

Conclusion

To convert JSON string to dict using Python, we can use the json.loads method.