简体   繁体   中英

Using JSON extractor to extract values from the response

I have 2 requests. In one request I have used the random text generator and generated some random string and passed that to a variable. After that a new record is created with than random name and unique ID is created. I want to fetch the ID of that record. How do I extract that using JSON extractor.

EG.

Srno name id 1 xvyhz 1230-1236(some id) 2 abczz 1230-1236(some id)

I want to get the ID of the 'abczz' which is created by random string generator function and stored in 'variablename' variable. So how to extract the ID of that generated string using JSON extractor.

If you are looking for meterId attribute value where meterName is abcio the relevant JSON Path expression will be something like:

$..[?(@.meterName == 'abcio')].meterId

Demo:

JMeter JSONPath条件选择

More information: API Testing With JMeter and the JSON Extractor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM