How to extract values from a json array using JMeter?

To extract values from a JSON array in JMeter, you can follow these steps:

  1. Add an HTTP request to send a request containing a JSON array.
  2. Add a JSON extractor to the HTTP response to extract values from an array. The JSON extractor can search and extract the desired values from the response’s JSON data.
  3. In the JSON extractor, choose “JSON Path Extractor” as the extractor type.
  4. In the “JSONPath” field, enter the JSON path of the value you want to extract. JSON path is an expression used to locate and extract JSON data. For example, if you want to extract the first value in an array, you can use “$[0]” as the JSON path.
  5. In the “Match No.” field, select the matching number you want to extract. If you want to extract all values in the array, you can choose “All”.
  6. In the “Default Value” field, input the default value to use when no matching item is found.
  7. In the “Name of created variable” field, enter a variable name to store the extracted value.
  8. In subsequent requests, you can use this variable to reference the extracted value.

By following these steps, you will be able to extract values from a JSON array in JMeter.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds