我将json发布到Python金字塔服务器,但无法在服务器端解析它。在
post请求如下所示:
$.ajax({
url: "http://localhost:6543/linefollower/7/send_result",
type: "POST",
data: '{"results": [{"robot_name": "Satikas", "result": null, "team_nr": 30, "team_name": "IT Vennad", "id": 57}]}',
contentType: "application/json; charset=utf-8",
dataType: "json"
}
但是在服务器端,当我打印的时候我会收到这个(请求.正文)在
^{pr2}$如何才能将发布的内容解析为JSON?金字塔什么时候该去request.json_主体是否包含已解析的json?在
请尝试在发送数据之前将其显式序列化为JSON:
我没有完美的答案,但我可以告诉你,这与编码有关。结构编码()或者u'str。你可以朝这个方向看。在
数据对象是字符串。它应该只是一个物体。删除引号
相关问题 更多 >
编程相关推荐