I am extracting a postgres table as json. The output file contains lines like:
{\"data\": {\"test\": 1, \"hello\": \"I have \\\" !\"}, \"id\": 4}
for my instance, i wrote:
STRING.replace("': '", '": "').replace("', '", '", "').replace("{'", '{"').replace("'}", '"}').replace("': \"", '": "').replace("', \"", '", "').replace("\", '", '", "').replace("'", '\\"')
and works like a charm.