Transfer: postprocessor JSON Extractor extracts a plurality of values json

json string [] denotes an array of objects, {} represents an object.

Object contains a number of "property": property value. Property value may be a value, or an array, or object.

 

JSON Extractor using json path expression matching can take a plurality of variable values. $ Root object represents the response. Attribute takes a child object or objects. Take the object with the array [] array index starts from 0.

 

Example:

1 to find a response result json format, response analysis results.

The following example is a response of the entire array, including four objects. Thus a value of $ [Index * take all or take 0-3] Property Value

If the response is similar to { "Properties": [{ "sx": 1}, {}, {}]}, the entire response is an object. Taking the value of sx: $ attributes [0] .sx.

 

2 jmeter step of adding a request analysis, and right points on the request to add post processors "JSON Extractor

  A plurality of parameter names separated by semicolons, json path expression that matches the first number, the default value must be a semicolon [delimiter]

  2 all have to match the number of addition [tried matchno (default value of 0), any one of the other three did not match the request is displayed in the result tree]

names of created variables: the received value of the variable name

json path: json path expression

match no: 0 random; n-value taking the first few matches; -1 Match all subsequent references of the N values ​​taken _N variable name.

default values: default value, the matching value less than the value taken when

 

3 a new http request acquisition parameters

 

4 Add the result tree, run, view the results.

 

Modify json extractor Gets an array of all the values 5    $ [*]. Property. match no = 3 take the first three.

 

After 6 match no = 5, array bounds, take default values

 

7 json extractor modify settings match match no = -1 all values; http request and modify the parameters for reception parameters $ {varname_N}. N = 1-4.

 

 

 

8 modified json extractor, $ {varname_N} after the N is not out of range parameter [not json extractor default values ​​in the set, because the N, P, F, D variable actual value to take]

 

 

Official website:  http://jmeter.apache.org/usermanual/component_reference.html#JSON_Extractor

 

json path :https://goessner.net/articles/JsonPath/ 

 

Original: https://www.cnblogs.com/dinghanhua/p/9823305.html

 

Guess you like

Origin www.cnblogs.com/lci05/p/11494226.html