[Python] beautify JSON
import json
print json.dumps({'4': 5, '6': 7}, sort_keys=True, ensure_ascii=False, indent=4)
{
"4": 5,
"6": 7
}
def pretty(obj):
return json.dumps(
obj,
ensure_ascii=False,
sort_keys=True,
indent=4)
https://stackoverflow.com/questions/9105031/how-to-beautify-json-in-python
How to beautify JSON in Python?
Can someone suggest how I can beautify JSON in Python or through the command line? The only online based JSON beautifier which could do it was: http://jsonviewer.stack.hu/. I need to use it from ...
stackoverflow.com
https://stackoverflow.com/questions/12943819/how-to-prettyprint-a-json-file
How to prettyprint a JSON file?
I have a JSON file that is a mess that I want to prettyprint. What's the easiest way to do this in Python? I know PrettyPrint takes an "object", which I think can be a file, but I don't know how t...
stackoverflow.com
https://torbjorn.tistory.com/221
Python3 json dump 한글 깨짐 해결방법
파이썬에서 json dump를 했더니 한글이 유니코드로 저장된다. 이유를 찾아보니 dump 메소드는 기본적으로 ascii 형태로 저장하기 때문. json dump 메소드에 ensure_ascii=False를 넣어줘야 잘 저장된다.
torbjorn.tistory.com