Django:UUID('') is not JSON serializable

视图处理完成后需要返回UUID,但是报错:UUID('') is not JSON serializable

其实只需要,将uuid转换为字符串类型

return HttpResponse(json.dumps({'status': '0000', 'msg': '保存成功', 'uuid': str(uuid), 'id': id}))

猜你喜欢

转载自www.cnblogs.com/gcgc/p/12146142.html