Program - Pretty print JSON


Topic: Program - Pretty print JSON

Solution

import json
person_string = '{"name": "Bob", "languages": "English", "numbers": [2, 1.6, null]}'
person_dict = json.loads(person_string)
print(json.dumps(person_dict, indent = 4, sort_keys=True))



List all Python Programs