Create a .new json file, and move, to avoid invalid JSON files on error