How can i print a json with special characters as "à" or "ç"?
I can print like this:
import json
weird_dict ={"person": "ç", "á": 'à', "ç": 'ã'}
print json.dumps(weird_dict, indent=4, sort_keys=True)
output:
{
"person": "\u00e7",
"\u00e1": "\u00e0",
"\u00e7": "\u00e3"
}
if i use 'ensure_ascii=False'
weird_dict={"person": "ç", "á": 'à', "ç": 'ã'}
print json.dumps(weird_dict, indent=4, sort_keys=True, ensure_ascii=False)
output:
{
"person": "ç",
"á": "à ",
"ç": "ã"
}
How to overcome special characters issue using json? I need to render when i use pystache and try to print pystache.render('Hi {{person}}!', weird_dict) it occurs me:
"'ascii' codec can't decode byte 0xc3 in position 4770: ordinal not in range(128)"