-2

I have the following string that is being returned from a regex extractor in a HTTP request.

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,

I would like to use the split this string to get values of all the attributes such as issuerText , networkType etc.

I am using beanshell sampler like

 vars line = vars.get(${issuerLogo2});
 String line = vars.get(${issuerLogo2});
 String line = vars.get("${issuerLogo2}"); 

etc.. i am getting error saying encountered '' Encountered "( ," or '' Encountered "\issuer\" ..

How do I escape the double quotes in the above string and get the issuerLogo2 value to a variable or another string in beanshell to split the string to get values of each attribute???

can someone pls help me on this ?

mo0206
  • 791
  • 5
  • 20
  • 36

1 Answers1

0

The correct Beanshell statement will look like:

String line = vars.get("issuerLogo2");

vars stands for JMeterVariables class instance hence vars.get() method expects variable name, and you're trying to pass variable value to it.

See How to use BeanShell: JMeter's favorite built-in component guide for more information on Beanshell scripting in JMeter.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I am trying to assign a string A to another string variable B without being able to change the initial string variable A. at the same time escape the double quotes in string A while assigning it to B. :-| – mo0206 Jun 23 '15 at 18:01