python -m json.tool解析 JSON 串
使用命令行终端的 Python 解释器来解析 JSON 串
echo ‘{“job”:”developer”,”name”:”lmx”,”sex”:”male”} ‘ | python -m json.tool
{
“job”: “developer”,
“name”: “lmx”,
“sex”: “male”
}
使用命令行解释器解析 JSON 串非常方便,而且,为了便于阅读,该工具还会自动将
转换的结果进行对齐和格式化
echo ‘{ “address”:{ “province “:”zhejiang”, “city”:”hangzhou” },”name”:”lmx”,”sex”:”male”}’ | python -m json.tool
{
“address”: {
“province “: “zhejiang”,
“city”: “hangzhou”
},
“name”: “lmx”,
“sex”: “male”
}