首页 > 编程知识 正文

json数组对象转化为json字符串,json字符串获取键值

时间:2023-05-06 01:07:55 阅读:130473 作者:513

var liststr='cn=3070091601,ou=BusCatalogGroups,dc=example,dc=com ';

//let key='=';

//let jsonstr=' ';

//JSON str=liststr.replace (new regexp ) key、' g '、' : ' );

//key=',';

//JSON str=JSON str.replace (new regexp ) key、' g '、'、'');

//jsonstr='{'' jsonstr ''} ';

//letJSON=JSON.parse(JSONstr );

//console.log(JSONstr;

//console.log(JSON.cn;

functionstrtojson (列表) )。

{

let key='=';

let jsonstr=' ';

jonstr=liststr.replace (new regexp ) key、' g '、' : ' );

key=',';

JSON str=JSON str.replace (new regexp ) key、' g '、'、'');

jsonstr='{'' jsonstr ''} ';

letJSON=JSON.parse(JSONstr;

返回强森;

}

letJSON=StrtoJSON(Liststr );

控制台. log (JSON.cn;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。