Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the function of JSON extractor

Shulou Source: shulou.com Published: 2022-06-01 14:03:10 11月11日 Update

This article is to share with you about the role of the JSON extractor, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. The function of JSON extractor.

The result of the JSON extractor used to extract the request is a value or a set of values in the json format data. The standard method is $.key, where key is a key in the returned result json. If it is multi-tier, you can continue to use .key. If you encounter the value of key as an array, use .key [n], where n is the index of the elements in the array.

2. Basic syntax description of JSON extractor

The JMeter JSON extractor is developed based on the third-party class library JsonPath, so to master the syntax of the JSON extractor, you need to understand JsonPath.

3. Detailed explanation of JSON extractor

Name: name of the JSON extractor

Comments: functional description of the JSON extractor

Scope of application:

① Main sample and sub-samples: sampler acting on parent nodes and samplers corresponding to child nodes

② Main sample only: this is the default, which only works on the sampler of the parent node

③ Sub-samples only: sampler that acts only on child nodes

④ JMeter Variable Name to use: acts on jmeter variables (you can enter the variable name of jmeter in the input box)

Parameter name: name of the variable stored in the extracted json data

JSON Path expressions: JSON Path expressions that extract JSON data

Match No. (0 or Random) (matching code): match the number of values. Do not enter the first one that meets the criteria by default. 0: random, N: get the Nth,-1: get all (when the match is-1 and the match result has multiple values, multiple values will be concatenated by comma, which can be called by parameter name _ ALL).

Compute comcatemation var (suffix_ALL): when checked, when multiple results are matched, the plug-in will connect them with the "," delimiter and store them in a var named _ ALL (to be used with Match Numbers:-1)

Default value: the default value when the parameter value is not obtained

This is what the JSON extractor does, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Functions results nodes samplers parameters variables multiple data names names arrays more knowledge articles expressions syntax storage input utility elements Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux NVidia Xiaomi OPPO Reno Docker