小编Mic*_*ter的帖子

{ "detail": "JSON 解析错误 - 期望值:第 1 行第 1 列(字符 0)" }

我正在使用 django-restframework,我使用邮递员 POST json 数据到我的项目,但我收到类似标题的错误,我已经设置了 raw 和 application/json 这里是邮递员的代码。

POST /account/post/reply/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: a0c7bd93-631e-4c7a-8106-87f018eaf7da

{
    "user": "michael",
    "userid": "1",
    "ihelpid": 6,
    "tittle": "6",
    "info": "6",
    "label": "3",
    "tel": "dxy970525",
    "picture1": null,
    "picture2": null
}
Run Code Online (Sandbox Code Playgroud)

我的代码非常简单,就像:

POST /account/post/reply/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: a0c7bd93-631e-4c7a-8106-87f018eaf7da

{
    "user": "michael",
    "userid": "1",
    "ihelpid": 6,
    "tittle": "6",
    "info": "6",
    "label": "3",
    "tel": "dxy970525",
    "picture1": null,
    "picture2": null
}
Run Code Online (Sandbox Code Playgroud)

我使用viewsets后,出现此错误,我已将其打印在shell上,但没有问题

django json python-3.x django-rest-framework

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

django ×1

django-rest-framework ×1

json ×1

python-3.x ×1