接口响应数据如下:
{ "msg": "ok", "result": { "total": 5530, "num": 2, "list": [ { "classid": 2, "process": [ { "pcontent": "首先将娃娃菜切条,虾仁去除虾线,蒜子切末,葱切葱花。", "pic": "http:\/\/api.jisuapi.com\/recipe\/upload\/20160719\/162543_79804.jpg" } ],
"name": "虾仁娃娃菜", "id": 3 }, { "classid": 2, "process": [ { "pcontent": "准备食材。", "pic": "http:\/\/api.jisuapi.com\/recipe\/upload\/20160719\/162550_84583.jpg" } ],
"name": "醋溜白菜", "id": 8
}
] }, "status": 0 }
需求:现在想获取响应结果list数组中所有对象的 name和id值
方法:使用jsonPath 提取器 提取公式:$.result.list[*].["name","id"]
提取结果:
End: 提取出来就可以拿去其它接口用了
扩展:jsonPath更多高级用法可参考:https://www.cnblogs.com/liveAndLearn233/articles/15424757.html
标签:提取,name,list,数组,json,key,com,id From: https://www.cnblogs.com/yanghr/p/16811769.html