postman js String 转换成json

var  jsonList=pm.response.text();
var json=JSON.parse(jsonList)
 function getValue( key1,key2, str ) { 
     
     var m = str.match( new RegExp(key1+'(.*?)'+key2) );
     
     return m ? m[ 1 ] : false;
 }
var access_token=json['data']['accessToken']
console.log(access_token);

pm.globals.set("access_token", access_token);

 

    原文作者:安果移不动
    原文地址: https://blog.csdn.net/mp624183768/article/details/90480857
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞