When we do interface testing with JMeter, we sometimes encounter some complex JSON responses. For example, the value of multi-layer list nesting
A simple example:
$.. Name: List all Provinces
$.. Province[0]. Name extracts the name from the first list in province
$.. [? (@. name== ' Beijing ')] filter out all list data in the province named Beijing
$. Province[:2].population Filter the top two data
Note: $. Province[:2].population is to filter out the first two data; $. Province[2].population is the elimination of the first two data; $. Province[-2].population is to exclude the latter two data, do not confuse Oh ~
Here is a complex example:
This is a multi-layered nested jsonlist that needs to be extracted from all Cabininfos lists, patflag=y Cabin,standardprice and Finallyprice. Does it sound complicated? If the traditional regular expressions are extracted, it is difficult to meet the requirements here. Therefore, a jsonpath expression is required.
$.. [? (@.patflag== "Y")]. ["Cabin", "Standardprice", "Finallyprice"]
Provide mock interface, JMeter Direct access: Https://easy-mock.com/mock/5b88b27476b79510db917603/example/query1
For other uses of Jsonpath, you need to continue to take research ~
Are you still worried about not finding the interface you can practice? Join Long now and teach you to build your own interface test environment!
Click here to enter the most dynamic test communication platform in history. !
Jmeter (33) _jsonpath Expression Pull response