2

I have a set of JSON templates in a CSV file and a DataInsert: {"Data":"${DataInsert}"}, testdatainsert Variables are defined as JSONTemplate,DataInsert

I'm running an HTTP request with the body: ${__V(JSONTemplate${DataInsert})}

And I would like this to send: {"Data":"testdatainsert"}

However, what I end up sending is JSONTemplatetestdatainsert

I dont think I understood this documentation very well: https://jmeter.apache.org/usermanual/functions.html#what_can_do

Any help would be appreciated.

Zyzyx
  • 492
  • 4
  • 18

1 Answers1

1

If you have a value from CSV which holds another JMeter Function or Variable - you need to wrap it into __eval() function in order to resolve the underlying variable (or function).

If you have:

  • DataInsert variable with the value of testdatainsert
  • JSONTemplate variable with the value of {"Data":"${DataInsert}"}

and you need to get {"Data":"testdatainsert"} - you need to refer the variable as:

${__eval(${JSONTemplate})}

Demo:

enter image description here

More information: Here’s What to Do to Combine Multiple JMeter Variables

Dmitri T
  • 159,985
  • 5
  • 83
  • 133