1,, and plug-in document information
https://jmeter-plugins.org/wiki/JSONPathExtractor/
The JSON information is as follows
{
"Error_code": 0,
"Stu_info": [
{
"id": 5047,
"Name": "LW",
"Sex": "Male",
"Age": 28,
"Addr": "No. 32nd, Xi ' an high-tech zone, Shaanxi",
"Grade": "Scorpio",
"Phone": "15512532946",
"Gold": 1600
}
]
}
2. Add JSON path extractor or JSON extractor or regular expression extractor to the HTTP request
3. How to configure the JSON plugin and how to configure the regular expression
4. View Results
5. How to use JSON
{"Store": {"book": [ {"category":"Reference","Author":"Nigel Rees","title":"Sayings of the Century","Price": 8.95}, {"category":"Fiction","Author":"Evelyn Waugh","title":"Sword of Honour","Price": 12.99}, {"category":"Fiction","Author":"Herman Melville","title":"Moby Dick.","ISBN":"0-553-21311-3","Price": 8.99}, {"category":"Fiction","Author":"J. R. R. Tolkien","title":"The Lord of the Rings","ISBN":"0-395-19395-8","Price": 22.99}],"Bicycle": {"Color":"Red","Price": 19.95}}}
XPath |
JSONPath |
Result |
< Code style= "font-family:"courier new", Courier, monospace ">/store/book/author |
$.store.book[* ". Author |
The authors of all books in the store |
//author |
$. Author |
all authors |
< Code style= "font-family:"courier new", Courier, monospace ">/store/* |
$.store.* |
all Things in store, which is some books and a red bicycle. |
/store//price |
$.store. Price |
the price of everything in the store. |
< Code style= "font-family:"courier new", Courier, monospace ">//book[3] |
$. BOOK[2] |
the third Book |
//book[last ()] |
$. book[(@.length-1)] $. Book[-1:] |
the last book in order. |
< Code style= "font-family:"courier new", Courier, monospace ">//book[position () <3] |
$. book[0,1] $. Book[:2] |
the first Books |
//BOOK[ISBN " |
$. Book[? ( @.isbn)] |
filter All books with ISBN number |
< Code style= "font-family:"courier new", Courier, monospace ">//book[price<10] |
$. Book[? ( @.price<10)] |
filter all books cheapier than |
//* |
$..* |
All Elements in XML document. All members of the JSON structure. |
JMeter retrieving JSON return information via JSON extrcator or regular expressions