SOURCE

var obj = {
  "baseDN": "dc=idsmanager,dc-com",
  "cnMapping": "username",
  "connType": false,
  "defaultPassword": "P@ssw0rd",
  "deleteConfiguration": "DISABLE",
  "displayNameKey": "sn",
  "domain": "demo.idsmanager.com",
  "emailKey": "mail",
  "enable": false,
  "enableLdapAutoSync": false,
  "externalIdKey": "cn",
  "fullUserDN": "entryDN",
  "ip": "127.0.0.1",
  "ldapDisplayName": "测试",
  "ldapType": "OPEN_LDAP",
  "ouUuid": "0000000000",
  "password": "P@ssw0rd",
  "passwordKey": "userPassword",
  "phoneNumberKey": "phone",
  "port": "389",
  "removeToOuDN": "OU=离职,OU=北京",
  "toIDPEnable": true,
  "username": "cn=admin,dc=idsmanager,dc=com",
  "usernameKey": "username",
  "uuid": ""
}


document.write("<div style='color: black;'>");


for (let key in obj) {
  /* <Member name="uuid" tagName="Uuid" type="String"/> */
  let type = '识别不出来这是啥';
  let capitalKey = key.charAt(0).toUpperCase() + key.substring(1)

  console.log(typeof obj[key])

  if (typeof obj[key] == "boolean") {
    type = "Boolean";
  } else if (typeof obj[key] == "number") {
    type = "Integer";
  } else if (typeof obj[key] == "string") {
    type = "String";
  }

  // if (type == -1) {
  //   document.write(key + ": 识别不出来这是啥")
  // } else {
    document.write("&lt;property pattern=\"request\" name=\"" + key + "\" mapping=\"data." + key + "\" type=\"" + type + "\"/>")
  // }

  document.write("<br>");

}

document.write("</div>");
console 命令行工具 X clear

                    
>
console