一、JSON提取器是一个后置处理工具
JSON提取器主要用于提取接口返回某个字段的值。
如下接口响应数据,提取OrderNo字段的值
JSON提取器说明:
**Apply to:**应用范围
**Names of created variables :**接收值的变量名,自定义,多个变量用分号分隔
JSON Path expression: json path表达式,也是用分号分隔
例:
{
"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
}
}
}
Match No.(0 for Random):
0表示随机;
n取第几个匹配值;
-1匹配所有。
若只要获取到匹配的第一个值,则填写1
**Compute concatenation var(suffix_ALL)*如果找到许多结果,则插件将使用’ , '分隔符将它们连接起来,并将其存储在名为 _ALL的var中
Default Values: 缺省值,匹配不到值的时候取该值,可写error。
检查通过json提取器是否正常获取到值,可添加“调试取样器”来检查