Dictionary to JSON
#Create a dictionary you want to output as JSON
my_dictionary = {
"value1": 3,
"value2": "abc",
"nested_values": {
"value_a": "hello",
"value_b": "world"
},
"value3": "def"
}
#Convert Python dictionary to JSON
my_json_string = json.dumps(my_dictionary, indent = 4)
#View the JSON object
print(my_json_string)
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.