Remove control characters before returning JSON