Reputation: 872
I searched on this site and mostly the questions are around JSON Path Extractor, not the native JSON Extractor Post Processor.
Using JMeter 5.1.1 , I am hitting https://reqres.in//api/users?page=2 which will return me JSON response
{
"page": 2,
"per_page": 3,
"total": 12,
"total_pages": 4,
"data": [
{
"id": 4,
"email": "[email protected]",
"first_name": "Eve",
"last_name": "Holt",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg"
},
{
"id": 5,
"email": "[email protected]",
"first_name": "Charles",
"last_name": "Morris",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/stephenmoon/128.jpg"
},
{
"id": 6,
"email": "[email protected]",
"first_name": "Tracey",
"last_name": "Ramos",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/bigmancho/128.jpg"
}
]
}
Using this JSON Extractor
I get
As we can see , JSON Extractor removes the double quotes , so instead having "[email protected]"
, we get [email protected]
.
Is there any way to keep the double quotes using JSON extractor ? I need to have the double quotes "[email protected]"
. Thanks.
Upvotes: 1
Views: 1177
Reputation: 58812
You can get all data using $.data[0]
After it add Regular Expression Extractor using your JMeter variable as email
and create a new variable using the following regex
email":"([^"]+)"
Template $1$
and Match No. 1
Then your value with quotes will be available using ${email_g0}
Upvotes: 1
Reputation: 123
As I know, no way to keep the double quotes when you using JSON extractor, exception you edit plugin JSON extractor. Or you can use JSR223 PostProcessor like that
Upvotes: 2