一次 JMeter 脚本请求错误 Could not read JSON: Unexpected character : expected a valid value 的解决笔记

        用 Badboy 录制的脚步,有个界面是 Ajax 提交表单,先有 HTTP Status 415 错误(解决方案参考《 一次 JMeter 脚本请求错误 HTTP Status 415 的解决笔记》),然后又有 Could not read JSON: Unexpected character ('%' (code 37)): expected a valid value 错误。监听器 "察看结果树" 可以看到服务器响应数据如下:
{"status":0,"data":"Could not read JSON: Unexpected character ('%' (code 37)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@172fa261; line: 1, column: 2]; nested exception is org.codehaus.jackson.JsonParseException: Unexpected character ('%' (code 37)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@172fa261; line: 1, column: 2]"}
        该次 http 请求如下图所示:
一次 JMeter 脚本请求错误 Could not read JSON: Unexpected character : expected a valid value 的解决笔记_第1张图片
        另外监听器捕捉到该次请求如下所示:
POST http://xxx.com/merServPlat/proc/modifySubmit.json
POST data:
%7B%22stageId%22%3A276%2C%22modifyTime%22%3Anull%2C%22merId%22%3A276%2C%22merCode%22%3A%22000100015200001%22%2C...

        POST data 里只有这些。这些明显是一个 json 串,只不过 JMeter 竟然把 json 串转义后再提交了。
        修改该次 HTTP 请求的 Body Data,把要提交的 json 串考进去,保存,重新运行测试,问题解决。

你可能感兴趣的:(json,expected,character,JMeter,read,valid,val,UNEXPECTED,could,a,not,JMeter提交失败)