Write a Python program to convert Python objects into JSON strings.


Topic: Write a Python program to convert Python objects into JSON strings.

Solution

import json
python_dict =  {"name": "David", "age": 6, "class":"I"}
json_dict = json.dumps(python_dict, sort_keys=True, indent=4)
print(f"json dict : {json_dict}")



List all Python Programs