Easily convert between Python data structures and JSON formatted strings.
Source Code
import json
# Convert dictionary to JSON string
data_dict = {"name": "John", "age": 30, "city": "New York"}
json_str = json.dumps(data_dict)
print(json_str)
# Convert JSON string back to dictionary
data_dict_again = json.loads(json_str)
print(data_dict_again)