[Solved] How to fix ‘\n’ from json?


Assuming your data object is a simple dict or list,all you need to do is:

with open(output_path, 'w') as f:
    json.dump(data, f, sort_keys=True, indent=4)

This will correctly dump to the output file.

3

solved How to fix ‘\n’ from json?