Member-only story

Extract multiple variables with JMeter JSON Extractor

Asanka Vithanage
2 min readJul 4, 2019

--

I wanted to extract multiple data points from a API response which is in JSON format. So I can use those values to do the subsequent API calls. JSON extractor comes in handy in these kind of situations.

JSON extractor is a highly used JMeter Post processor and Can read further on https://jmeter.apache.org/usermanual/component_reference.html#JSON_Extractor

As document says JSON extractor provides capability to create multiple variables reading data with different JSON paths. Basically we need to separate Variables, JSON Path Expressions, Default Values with Semi-colon and rest will handle by the JMeter.

But I got stuck in a situation that JMeter doesn’t work as described above. Basically Post Processor was failing with exceptions on the logs. Please see below image

As you can see I haven’t set the default values on the JSON extractor. Documentation also clearly mention Default Values is not a required field.

But unfortunately when we try to extract and create multiple variables, filling default values has become a mandatory requirement. This looks like bug in the code actually.

Filling Default Values field with matching number of default values resolved my issue, Please see the below image

--

--

Asanka Vithanage
Asanka Vithanage

Written by Asanka Vithanage

Software Quality Assurance Professional, Problem Solver, SOA Tester, Automation Engineer, CI/CD Practitioner, DevOps enthusiast

Responses (3)