📜  fomat json 加载 python 代码示例

📅  最后修改于: 2022-03-11 14:45:43.574000             🧑  作者: Mango

代码示例1
import json

your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]'
parsed = json.loads(your_json)
print(json.dumps(parsed, indent=4, sort_keys=True))

#output:
'''
[
    "foo", 
    {
        "bar": [
            "baz", 
            null, 
            1.0, 
            2
        ]
    }
]
'''