I am constructing JSON dictionary with some special characters to print words in bold and various colors on the bash terminal like this:
# 'field' is a part of a bigger JSON document 'data'
field["value"] = '\033[1m' + string_to_print_in_bold + '\033[0m'
Later on, I'm calling dumps
to create and print out my JSON:
print(json.dumps(data, indent=4, ensure_ascii=False))
However, on the terminal I see this:
"value": "\u001b[1mstring_to_print_in_bold\u001b[0m"
instead of
"value": "string_to_print_in_bold"
Note that ensure_ascii=False!
What am I missing?