[lang-ref] ( pretty_print_with_json ) ( python )

def test_pretty_print_with_json():
    # print(json.dumps(o, indent=2))
    import json
    o = { 'name': 'test', 'lines': ['val1', 'val2', 'val3'] }

    out = json.dumps(o, indent=2)

    expected = '''\
{
  "name": "test",
  "lines": [
    "val1",
    "val2",
    "val3"
  ]
}\
'''
    assert out == expected