In JMeter I need JSON Extractor to only extract, if a condition is satisfied, since if it tries to extract data that does not exist, it will not let the sampler that its attached to go. In the screenshot you can see ticketId <<< JSON, i need it to not start extracting if totalRecords = 0
I hope there is a tool suitable for that in JMeter
Unfortunately as of JMeter 5.6.3 you cannot apply PreProcessors conditionally. There is
Default Valuessection where you can provide some placeholder value in case if extraction fails:It will be stored into a JMeter Variable and then the variable can be used later on for example in If Controller
Alternatively you can use JSR223 PostProcessor instead of JSON Extractor,
Groovy has built-in JSON support and it's also possible to use the same JsonPath library which is used in the JSON Extractor:
Something like:
More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?