I'm' trying to convert string to JSON file using the json.dump
method.
Before the conversion, I need to add escape character before each char that represented as hex for example '\x00'
or '\x96'
.
In the end I need to convert string like:
'\x94\xa0aaa'
To:
'\\x94\\xa0aaa'
How can I do it? I tried to use the replace
method, but it didn't work.