Reputation: 13
My last question was closed somehow. hence creating a new question.
I've the below JSON response received from the HTTP request. I want to extract the page number(i.e 1574) from the node. can some one please assist how to do it with Regular expression in jmeter ? or any other approach?
updated response:
"links": {
"first": {
"href": "https://example.com/aaa/a/aa?page%5Bnumber%5D=1&page%5Bsize%5D=25&sort=-modifiedDate&page[number]=1",
"rel": "first"
},
"next": {
"href": "https://example.com/aaa/a/aa?page%5Bnumber%5D=1&page%5Bsize%5D=25&sort=-modifiedDate&page[number]=2",
"rel": "next"
},
"last": {
"href": "https://example.com/aaa/a/aa?page%5Bnumber%5D=1&page%5Bsize%5D=25&sort=-modifiedDate&page[number]=1574",
"rel": "last"
}
},
"meta": {
"totalCount": 39334
}
}
I have tried below data in Regular expression in Jmeter but could not retrieve 1574 value.
Regular expression: links.last.href.=(\d+)" Template: $1$ Match: 1 Default value: pageno_not_found
Upvotes: 0
Views: 139
Reputation: 168157
The easiest solution is going for 2 Post Processors:
JSON JMESPath Extractor to get the href
attribute for the "last" link:
Regular Expression Extractor to get the "number" from the variable generated by the JSON JMESPath Extractor
Demo:
Upvotes: 1