我在HTTP请求中从正则表达式提取器返回以下字符串。
issuerLogo2=,"issuerText":"humanaillinoishmo","networkType":"HMO","networkKey":"58288-ILN002","planScore":0.0,"rawOutOfPocketCost":0.0,"outOfPocketEstimate":0.0,"premiumBeforeCredit":231.29,"annualPremiumBeforeCredit":2775.48,"aptc":0.0,"totalContribution":0.0,"premiumAfterCredit":231.29,"annualPremiumAfterCredit":2775.48,"costSharingReductions":0.0,"adjustedOop":0.0,"oopMax":6300.0,"childOopMax":null,"maxTotalHealthCareCost":0.0,"estimatedTotalHealthCareCost":5075.48,"costSharing":null,"deductible":6100,"intgMediDrugDeductible":null,"medicalDeductible":4600,"drugDeductible":1500,
我想使用split this string来获取所有属性的值,例如issuerText,networkType等。
我正在使用像
这样的beanshell sampler vars line = vars.get(${issuerLogo2});
String line = vars.get(${issuerLogo2});
String line = vars.get("${issuerLogo2}");
等...我收到错误说遇到了''遇到"(,"或''遇到" \ issuer \" ..
如何在上面的字符串中转义双引号并将issuerLogo2值转换为beanshell中的变量或另一个字符串,以拆分字符串以获取每个属性的值???
有人可以帮我这个吗?
答案 0 :(得分:0)
正确的Beanshell语句如下所示:
String line = vars.get("issuerLogo2");
vars
代表JMeterVariables类实例hence vars.get()
方法需要变量名称,并且您尝试将变量值传递给它。
有关JMeter中Beanshell脚本的更多信息,请参阅How to use BeanShell: JMeter's favorite built-in component指南。