我收到以下错误,
Error: Error parsing JSON string: Unexpected token <
Given: <html>
<body>
<p>
<b>400.</b> Invalid json request: numOfDays=1&checkInDate=2013-04-10.
Make sure that key names and text values are quoted with "
</p>
</body>
</html>
Stacktrace:
使用以下代码:
var frisby = 要求('frisby');
frisby.create('Ensure proper values in specified keys')
.post('http://localhost:9090/bookRoom', {"numOfDays": 1 , "checkInDate":"2013-04-10"})
.expectJSON({
"checkInDate": "2013-04-10",
"checkOutDate": "2013-04-11",
"totalPrice": 130
})
.toss()
我正在尝试传递这个 JSON - {"numOfDays": 1 , "checkInDate":"2013-04-10"}
编辑:
似乎正在传递的 JSON 格式如下。我如何摆脱那些反斜杠?
Handling booking request: "{\"numOfDays\":\"1\",\"checkInDate\":\"2013-04-10\"}"