I have to assert JSON response of an API. So extracted value of a field (state) using JSON path extractor and save it in variable (Optinurl)
"state":"opted_in"
In the Debug Sampler, i see the value of Optinurl as
Optinurl= [ : "opted_in" ]
Optinurl_1=opted_in
Optinurl_matchNr=1
When i try to retrieve value of variable Optinurl in Beanshell assertion as below,
String optinValue = ${Optinurl}
i get
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: String optinValue = '["opted_in"]';'' Token Parsing Error: Lexical error at line 1, column 23. Encountered: "\"" (34), after : "\'["
2016/03/07 14:40:15 WARN - jmeter.assertions.BeanShellAssertion: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:
String optinValue = '["opted_in"]';'' Token Parsing Error: Lexical error at line 1, column 23. Encountered: "\"" (34), after : "\'["
Thanks for your help in advance !