为了账号安全,请及时绑定邮箱和手机立即绑定

Cannot convert object to primitive value

Cannot convert object to primitive value

胡子哥哥 2018-10-03 09:37:34
如下是我的提交数据(json):{"form_1":[{"resultName":"","level":"","unitOrder":"","winner":"","winnerOrder":"","date":"1","score":""}], "form_2":[{"resultName":"","level":"","unitOrder":"","winner":"","winnerOrder":"","date":"1","score":""}], "form_3":[{"resultName":"","level":"","unitOrder":"","winner":"","winnerOrder":"","date":"1","score":""}] }然后express下获取req.body打印:console.log(req.body)报错:TypeError: Cannot convert object to primitive value请问这种情况怎么回事呢?我要如何正确获取传过来的数据
查看完整描述

1 回答

?
不负相思意

TA贡献1777条经验 获得超10个赞

数据类型转换不成功 提交数据应该是集合类型,外面的"form_1",不能找到对应的字段,后面还有"form_2"。。这个的,建议去掉,直接{1:{},2:{},3:{}},这样提交


查看完整回答
反对 回复 2018-11-04
  • 1 回答
  • 0 关注
  • 6197 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信