Read from and write to a JSON file, minimizing diffs and preserving formatting.