"Ensure_ascii = False" is the miso.
sh
$ echo '{"one":1, "two":2, "Japanese":"Ah ah"}' | python -c 'import sys,json;print json.dumps(json.loads(sys.stdin.read()),indent=4,ensure_ascii=False)'
{
"Japanese": "Ah ah",
"two": 2,
"one": 1
}
I really want to use python -mtool.json as below, but the Japanese part is escaped.
sh
$ echo '{"one":1, "two":2, "Japanese":"Ah ah"}' | python -mjson.tool
{
"one": 1,
"two": 2,
"\u65e5\u672c\u8a9e": "\u3042\u3042\u3042"
}
Recommended Posts