Python Format Json Output

June 25, 2019
import json

data = {'name': 'Desmond', 'age': 40}

json.dumps(data, indent=2)
{
  "age": 40,
  "name": "Desmond"
}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.