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;