微信小程序json与xml互相转换

1、首先在目录结构中引入必要的js文件

https://files.cnblogs.com/files/qianyou304/x2j.rar

2、js中代码如下:(部分)json 2 xml

var X2JS = require(‘../../lib/x2js/we-x2js‘);
var loginJson =
    {
        "Name": "LOGIN",
        "Info": {
          "userName": "test001",
          "password": "000000",
          "accessTime": "2019-09-12 15:19:40"
        }
    }          
var x2js = new X2JS();
var loginXml = x2js.js2xml(loginJson);

  

3、xml 2 json以此类推即可

 

点击进入原文  微信小程序json与xml互相转换

微信小程序json与xml互相转换

上一篇:微信小程序 base64ToArrayBuffer


下一篇:企业微信获取用户信息