Use safe json_encoder