Postman:Object转str

  1. 提取接口的某个返回值,但这个值是Object类型,Like this:


    图片.png
  2. 错误做法:
    var unNotice = jsonData.rows;
    pm.environment.set("unNoticeItem", unNotice);

这样的结果就是:postman里unNoticeItem这个变量存的数据都是
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

  1. 正确做法:
    var unNotice = jsonData.rows;
    unNoticeItem = JSON.stringify(unNotice);
    pm.environment.set("unNoticeItem", unNoticeItem);

你可能感兴趣的:(Postman:Object转str)