if anybody with some knowledge about pretty printing JSON could help me with this I would be extremely grateful!
I\'m looking to convert a complex python string into
You are writing Python representations, not JSON.
Use the json.dump() function to write pretty-printed JSON instead, directly to your file:
with open('data.txt', 'wt') as out: res = json.dump(obj, out, sort_keys=True, indent=4, separators=(',', ': '))