prashant prashant - 8 days ago 6
JSON Question

Jmeter extracting fields/parsing JSON response

I have following JSON format in response body

[
{
"Name" : "Prashant",
"City" : "Sydney"
},
{
"Name" : "Yogi",
"City" : "London"
}
]


What is the better way for checking if this array has any records and if yes give me "Name" for first array index. I am using jp@gc JSON extractor plugin for jMeter.

Is it possible to parse this using a plugin or do I need to do it using regular expressions?

Answer

Using Ubik Load Pack JSON plugin for JMeter, you can do it:

Test Plan overview:

enter image description here

ULP_JSON PostProcessor:

enter image description here

If Controller:

enter image description here

And here is the run result:

enter image description here

So as you can see it is possible with our solution

Comments