remove bad characters bofore translating to json