python中这个错误的原因是json.dumps无法对字典中的datetime时间格式数据进行转化,dumps的原功能是将dict转化为str格式,不支持转化时间.
所以请这样使用:

json.dumps(response_data, default=str)

TypeError: Object of type ‘datetime‘ is not JSON serializable相关推荐

  1. TypeError: Object of type 'datetime' is not JSON serializable

    json序列化时间对象的时候报错: TypeError: Object of type 'datetime' is not JSON serializable 解决办法 重写json序列化类 # -* ...

  2. Flask API TypeError: Object of type 'Response' is not JSON serializable

    Flask API TypeError: Object of type 'Response' is not JSON serializable 错误代码: session['image'] = str ...

  3. 成功解决TypeError: Object of type 'ndarray' is not JSON serializable

    解决问题 TypeError: Object of type 'ndarray' is not JSON serializable 解决方法 def default(self, obj):if isi ...

  4. 【文件处理】——字典写入json文件或TXT文件,读取文件中的字典TypeError: Object of type ‘ndarray‘ is not JSON serializable错误解决方法

    目录 一.将字典写入json文件 二.json文件中读取字典 三.将字典写入TXT文件中 四.从TXT中读取字典 五.解决字典含数组存入json文件失败的方法 1.存入前将数组变成列表 2.扩展类方法 ...

  5. labelme2coco问题:TypeError: Object of type 'int64' is not JSON serializable

    最近在做MaskRCNN 在自己的数据(labelme)转为COCOjson格式遇到问题:TypeError: Object of type 'int64' is not JSON serializa ...

  6. TypeError: Object of type set is not JSON serializable

    今天运行flask项目突然报TypeError: Object of type set is not JSON serializable错误,上网搜了一下 该对象是set形式,json序列不支持,回到 ...

  7. 返回 JSON 格式数据报错:TypeError: Object of type set is not JSON serializable

    在做 flask 项目的时候需要返回一个 JSON 数据,运行的过程中却报错:TypeError: Object of type set is not JSON serializable 报错位置如下 ...

  8. Python TypeError: Object of type ‘Decimal‘ is not JSON serializable 类型错误 无法json

    场景:今天使用python 查询了一个MYSQL 数据库的信息  数据库的字段为decimal 类型 我将结果进行json.dumps 报错 TypeError: Object of type 'De ...

  9. 记录:TypeError: Object of type int32 is not JSON serializable。

    rect_list = list()...rect_list.append(rect1)rect_list.append(rect2)...rsp = {'rect-list': rect_list} ...

最新文章

  1. 开源ImageFilter库v0.3:新增22种图片效果
  2. javascript对象的几种创建方式
  3. 一次Ping1000个IP会怎么样?
  4. 数据结构课程设计---最长公共子串
  5. 有效的云安全态势始于三个步骤
  6. hadoop2.x的变化
  7. 速读-A3基于注意力机制的神经网络处理器
  8. openwrt搭建环境
  9. 【181023】VC++开发的电路板画图设计软件源代码
  10. topaz remask破解版|topaz remask抠图神器5破解版下载
  11. 多人的证件照放在一张纸上怎么排版
  12. Improving Graph Collaborative Filtering with Neighborhood-enriched Contrastive Learning(个人笔记)
  13. python笔试编程题_Python自动化测试笔试面试时常见的编程题
  14. Linux-alias设置命令别名
  15. Python学习 Day29 正则表达式(一)
  16. Odoo产品分析 (三) -- 人力资源板块(6) -- 工资表(2)
  17. PMP,IPMP,CPMP的区别
  18. java int随机数_java的三种随机数生成方式
  19. b站coderwhy老师_购物首页开发
  20. 股票量化API接口的实例代码分享

热门文章

  1. 【TypeScript系列教程02】安装及使用
  2. 如何做好内容策划并完成一篇合格的深度文?
  3. 学习笔记-AngularJs(四)
  4. MVC 之var与dynamic
  5. Html5 填表 表单(二) input type 各种输入, 各种用户选择,上传等等泛输入用户交互
  6. VUE.js 中取得后台原生HTML字符串 原样显示问题
  7. 原型 - 实现自己的jQuery
  8. vue 简单实用的elementUI表格封装
  9. 2019 The 19th Zhejiang University Programming Contest
  10. 使用maven插件构建docker镜像