运行 ❯
获取您
自己的 Python
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
import json x = { "name": "John", "age": 30, "married": True, "divorced": False, "children": ("Ann","Billy"), "pets": None, "cars": [ {"model": "BMW 230", "mpg": 27.5}, {"model": "Ford Edge", "mpg": 24.1} ] } # sort the result alphabetically by keys: print(json.dumps(x, indent=4, sort_keys=True))
{
"age": 30,
"cars": [
{
"model": "BMW 230",
"mpg": 27.5
},
{
"model": "Ford Edge",
"mpg": 24.1
}
],
"children": [
"Ann",
"Billy"
],
"divorced": false,
"married": true,
"name": "John",
"pets": null
}