write to json file