Rewrite a json file