read/write file in json and fix to prevent incrementing missing key