在Django中我们取出的数据有时候是decimal类型的对象,无法使用json对其进行传输,
为了将lat
字段取出组合与其他数据组合成Json对象发送给前端,需要用如下方式进行提取:
point[‘lat’] = record.lat.to_eng_string()
python-TypeError: Object of type 'Decimal' is not JSON serializable 报错
猜你喜欢
转载自blog.csdn.net/qq_38627475/article/details/104683563
今日推荐
周排行