Reputation: 21
I want to fetch one parameter from JSON response in the JMeter tool.
Currently, I am calling one API through JMeter and in response I got various parameter in jason format, but I want to fetch single parameter from that request and want to call another API Using that Parameter.
Upvotes: 2
Views: 654
Reputation: 168157
Since JMeter 3.0 there is JSON Extractor which can execute arbitrary JSON Path queries against responses, this way you will be able to extract the data you require and store it into a JMeter Variable for later re-use.
See API Testing With JMeter and the JSON Extractor guide for comprehensive information and real-life use-case.
Upvotes: 0
Reputation: 463
Use extractors to parse response and get any data from it. E.g. if your JSON response looks like this:
{
"TITLE": "Empire Burlesque",
"ARTIST": "Bob Dylan",
"COUNTRY": "USA",
"COMPANY": "Columbia",
"PRICE": "10.90",
"YEAR": "1985"
}
You can use this options:
Of course you can use Beanshell, JSR22 or jQuery extractors.
After extracting data to variable my_title
you can use this variable in another requests like this ${my_title}
Upvotes: 4