问答 Postman 获取 body 中返回参数报错 JSONError: Unexpected token,求问怎么解

YANG · 2018年11月01日 · 最后由 debugerliu 回复于 2019年11月01日 · 3711 次阅读

var jsonData = JSON.parse(responseBody);

发送请求后直接报错
There was an error in evaluating the test script: JSONError: Unexpected token 'j' at 1:1 jsonp1({"ec":200,"em":"success","data":{"book_data":{"book_id":201,"is_black":f ^

共收到 3 条回复 时间 点赞

你的请求长啥样?

你返回的内容是 jsonp,不是 json;
正常的 json 长这样

{"hello":"world"}

JSONP 长这样

cb_15646ad4aw({"hello":"world"})

可以先处理下,再转

大神我觉得您说的很对,可以私信回复继续帮助下吗,谢谢了

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册