参考文档:
https://www.journaldev.com/33302/python-pretty-print-json
https://docs.python.org/3/library/json.html#json.dumps
- 首先,我们使用json.loads()从json字符串创建json对象,字典类型。
- json.dumps()方法接受json对象,并返回JSON格式的字符串。
indent参数用于定义格式化字符串的缩进级别。

参考文档:
https://www.journaldev.com/33302/python-pretty-print-json
https://docs.python.org/3/library/json.html#json.dumps
indent参数用于定义格式化字符串的缩进级别。