Reputation: 1149
I have JSON request as following:
{
"type": "SIGNUP",
"data": {
"userAccountInfo": {
"email": "[email protected]",
"password": "qweQwe123!"
},
"userAddressInfo": {
"country": "United States"
},
"userPersonalInfo": {
"firstName": "test",
"lastName": "test"
}
}
}
How can extract [email protected] from the following request, considering the value of the email is always dinamic?
Any help is appreciated!
Upvotes: 0
Views: 76
Reputation: 168082
If you're talking about HTTP Request sampler and the above JSON is in the "Body Data" tab like:
You can extract the email by adding a JSR223 PreProcessor and using the following code there:
vars.put('email', new groovy.json.JsonSlurper().parseText(sampler.getArguments().getArgument(0).getValue()).data.userAccountInfo.email)
It will extract the value you're looking for and store it into ${email}
JMeter Variable
More information:
Upvotes: 1