我正在通过SOPAUI向Rest服务发送一个json请求。
POST http://xxxxxx.net:11080/v01/rest/login/auth HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json;charset=UTF-8
Content-Length: 142
Host: xxxxxxxxxx:11080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
{
"loginName": "po1537",
"password": "*@LMG6"l",
"providerNumber": 'ParkOne537',
}
但是像
那样得到错误<data contentType="text/plain" contentLength="235"><![CDATA[ParseError at [row,col]:[0,86]
Message: Expected a ',' or '}' at character 86 of {"Login":{
"loginName": "po1537",
"password": "*@LMG6"l",
"providerNumber": 'ParkOne537',
}}. ]]></data>
此密码是动态生成的,有时密码包含双引号。如果值中有双引号,我会观察到错误抛出错误。
答案 0 :(得分:0)
你有一个微不足道的错误。删除最后一个键值对的,
。
更改自:
{
"loginName": "po1537",
"password": "*@LMG6"l",
"providerNumber": 'ParkOne537',
}
要:
{
"loginName": "po1537",
"password": "*@LMG6"l",
"providerNumber": 'ParkOne537'
}