且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Postman中的对象数组中提取值

更新时间:2023-02-19 09:21:39

如果它是对象数组,则只需使用索引[0]选择第一个对象,然后再按如下方式获取对象的键即可:

If it is an array of objects, then just select the first object using index [0] before grabbing the object's key like this:

var data = JSON.parse(responseBody);   
postman.setEnvironmentVariable("userid", data[0].Id);