无法解析包含" \",
的响应{"Content":"[{\"SummaryID\":\"402014189352\",\"PeriodID\":\"3079\",\"PeriodName\":\"Q3 16\",\"SummaryData\":[{\"SummaryID\":\"402014189352\",\"Date\":\"11\/11\/2016\",\"RawMatrixData\":\"{\\\"LstEstimateInfo\\\":[{\\\"TemplateID\\\":402014189251,\\\"SummaryID\\\":402014189352,\\\"TemplateName\\\":\\\"Template_201611119\\\",\\\"TemplateDate\\\":\\\"11\/11\/2016 08:48:09\\\",\\\"SelfServe\\\":true}],\\\"LstPeriodList\\\":[{\\\"PeriodName\\\":\\\"Q1
答案 0 :(得分:1)
尝试使用Regular Expression Extractor
和BeanShell Post Processor
。
步骤如下:
在Regular Expression Extractor
中添加以下正则表达式(以检索日期值):
"Date\\":\\"(.*?)"
按如下方式添加BeanShell代码(在第一场比赛中删除" \"):
String str1=vars.get("date_1").toString();
log.info("Before " + str1);
String temp = str1.replace("\\","");
log.info("After " + temp);
vars.put("date_formatted", temp);
答案 1 :(得分:0)
String str1=vars.get("SummaryID").toString();
String str2=vars.get("TemplateID").toString();
log.info("Before " + str1);
log.info("Before " + str2);
java.lang.String temp = str1.replace("\\","");
java.lang.String temp1 = str2.replace("\\","");
log.info("After " + temp);
log.info("After " + temp1);
vars.put("date_format1", temp);
vars.put("date_format2", temp1);
尝试上面的代码,删除“\”,当我想传递$ {SummaryID_1}时,发布请求无效。