我正在尝试发送以下JSON对象,我收到下面显示的错误,我检查了@ http://jsonviewer.stack.hu,JSON格式似乎是正确的,我错过了什么以及如何解决这个问题?
{"component":{"name":"Company tech (New Bugs)", "version":"B"},"assignee":1234456,"milestone":"chiHW","priority":2,"state":"Analyze","substate":"Nominate","title":"[please ignore]CS\:4355C1\,4364B2\:WDI\:DHD\:HLK\(16299\)\-\>\"DF\ \-\ Sleep\ Tests\"\-\>Assert\-\>bcmpciedhd63\.sys\(dhd\_os\_ioctl\_resp\_wait\)\-\>dhd\_ndis\.c\@4449"}
错误: -
{"message":"An invalid JSON Object was passed in the request body. Please pass a valid JSON object.","help":"View documentation at http://bugs.company.com/","title":"Invalid Request","status":"400 Bad Request"}
答案 0 :(得分:1)
您可以将表达式粘贴到https://jsonlint.com。它会告诉您问题所在,并且您可以进行试验,直到JSON不再无效。在您的情况下,问题是最后一个字典值中的反斜杠(开始的那个#34;请忽略")。
答案 1 :(得分:0)
您可以使用jq来获取更具体的解析错误
watson:~$ cat >j
{"component":{"name":"Company tech (New Bugs)", "version":"B"},"assignee":1234456,"milestone":"chiHW","priority":2,"state":"Analyze","substate":"Nominate","title":"[please ignore]CS\:4355C1\,4364B2\:WDI\:DHD\:HLK\(16299\)\-\>\"DF\ \-\ Sleep\ Tests\"\-\>Assert\-\>bcmpciedhd63\.sys\(dhd\_os\_ioctl\_resp\_wait\)\-\>dhd\_ndis\.c\@4449"}
^D
watson:~$ jq <j
parse error: Invalid escape at line 1, column 333