Jmeter (33) _jsonpath Expression Pull response

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.