How to Parse Data From JSON Into Python - LinuxConfig.org

Python uses the loads method from the json to load JSON from a string. Did you notice the quotes around that dictionary that you created for the JSON? That's because Python treats JSON as a string unless it's coming from a file. You don't really need to worry about it too much. Just know that this form handles data while load handles files. Try loading the JSON.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-parse-data-from-json-into-python

I have json files that use ‘single quotes’ instead of “double quotes”.
Is there an option that will let me process these files?

Hi you have a bug here.

json_data = '{"a": 1, "b"**"**: 2, "c": 3, "d": 4, "e": 5}'

And here

print(json.loads(json_data)