shizz
shizz

Reputation: 21

Jmeter: variable in JSON file is not changed by extracted value

I have 2 requests: 1) creating new publication 2) updating it

After the first call I extract $reportId from JSON response. In second request I define a file with JSON data in 'Body Data': ${__FileToString(update_report_json_request.txt,,)} Inside the file I add extracted reportId: {"sourceuri":"db://reports/${reportId}"}

But value is not being set, and content from file is sent as it is. How can I pass extracted previously value to the file used for POST data?

Upvotes: 1

Views: 283

Answers (1)

Ori Marko
Ori Marko

Reputation: 58862

Add eval function wrapping the result:

${__eval(${__FileToString(update_report_json_request.txt,UTF-8,)})}

eval function returns the result of evaluating a string expression.

Upvotes: 1

Related Questions