python 格式化输出 json 数据
import json
data
= {
"msg": {
"crc": 0,
"msg_body": "How are you ?",
"msg_len": 88,
"recv_id": 319371,
"send_id": 319371,
"send_time": 0,
"type": 96
},
"msgLen":90
}
print(json
.dumps
(data
, sort_keys
=True, indent
=2))
运行结果
{
"msg": {
"crc": 0,
"msg_body": "How are you ?",
"msg_len": 88,
"recv_id": 319371,
"send_id": 319371,
"send_time": 0,
"type": 96
},
"msgLen": 90
}
转载请注明原文地址: https://yun.8miu.com/read-22491.html