📜  json数据在线测试-Java代码示例

📅  最后修改于: 2022-03-11 14:52:11.837000             🧑  作者: Mango

代码示例3
var response = JSON.parse(responseBody);
//pm.environment.set("offerIdNumeric", response.details.quotes[0].offers[0].id);
var group = 'SALAMA';
response.details.quotes.map(quote => {
quote.offers.map(offer => {
    response.push({id:offer.id,group:offer.groupId});
})
});
var filtered = response.filter((record,i) => record.group.indexOf(group) != -1);
var id = filtered[0].id;
pm.environment.set("offerIdNumeric", id);
console.log(filtered);
console.log(id)