【问题标题】:Unexpected character (')' (code 41)) in JMeter requestJMeter 请求中的意外字符 (')' (代码 41))
【发布时间】:2018-01-03 12:09:37
【问题描述】:

录制后,我使用变量并运行。 正文数据:

{
    "data: [
        {
            "gsVersion":"1.0",
            "stepCode":"${stepCode}",
            "stepName":"${stepName}",
            "familyId":"${familyId}",
            "listGeoEventAddOfStep": [
                {
                    "id":0,
                    "geoEventCode":"${geoEventCode}",
                    "name":"${geoEventName}")},
                    "description":"${geoEventDes}"
                }
            ]
        }
    ]
}

但是,它给出了回应:

    {
    "timestamp":1514976739620,
    "status":400,
    "error":"Bad Request",
    "exception":"org.springframework.http.converter.HttpMessageNotReadableException",
    "message":"Could not read document: Unexpected character (')' (code 41)): was expecting comma to separate Object entries\n at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 175]\n at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 150] (through reference chain: com.geopost.controller.requestbody.RequestBodyList[\"data\"]->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO[\"listGeoEventAddOfStep\"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected character (')' (code 41)): was expecting comma to separate Object entries\n at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 175]\n at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 150] (through reference chain: com.geopost.controller.requestbody.RequestBodyList[\"data\"]->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO[\"listGeoEventAddOfStep\"]->java.util.ArrayList[0])",
    "path":"/rest/steps"
}

为了更清楚,提取异常消息:

Could not read document: Unexpected character (')' (code 41)):
 was expecting comma to separate Object entries
 at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 175]
 at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 150]
 (through reference chain: com.geopost.controller.requestbody.RequestBodyList["data"]
   ->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO["listGeoEventAddOfStep"]
   ->java.util.ArrayList[0]);

nested exception is com.fasterxml.jackson.databind.JsonMappingException:
Unexpected character (')' (code 41)):
 was expecting comma to separate Object entries
 at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 175]
 at [Source: java.io.PushbackInputStream@4fa24716; line: 1, column: 150]
 (through reference chain: com.geopost.controller.requestbody.RequestBodyList["data"]
   ->java.util.ArrayList[0]
   ->com.geopost.dto.GeoStepAddDTO["listGeoEventAddOfStep"]
   ->java.util.ArrayList[0])

我该如何解决这个问题?

【问题讨论】:

标签: jmeter http-response-codes


【解决方案1】:

你的 JSON 无效,例如你有不相关的) 符号,一个有效的 JSON 可以是:

{"data":[{"gsVersion":"1.0","stepCode":"${stepCode}","stepName":"${stepName}","familyId":"${familyId}","listGeoEventAddOfStep":[{"id":0,"geoEventCode":"${geoEventCode}","name":"${geoEventName}"}],"description":"${geoEventDes}"}]}

您可以检查您的 json online

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 1970-01-01
    • 2013-03-16
    • 2015-08-28
    • 2018-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多