import json data = {'name': 'John', 'age': 30, 'city': 'New York'} formatted_json = json.dumps(data, indent=2) print(f"Original Data:\n{data}\nFormatted JSON:\n{formatted_json}")
Output:
Original Data:
{‘name’: ‘John’, ‘age’: 30, ‘city’: ‘New York’}
Formatted JSON:
{
“name”: “John”,
“age”: 30,
“city”: “New York”
}