Skip to content

Cikayo/wx-xml2js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wx-xml2js

Copy xml2js and adapt it to wechat.

Description

For options, please refer to: xml2js


npm install wx-xml2js

or

yarn add wx-xml2js

Convert xml to json:

import xml2js from 'wx-xml2js'
xml2js.parseString(xml, (err, result) => {
  if(err) {
    // some thing
  }
})

Convert json to xml:

import xml2js from 'wx-xml2js'
var jsonData = '<xml><ToUserName>abc</ToUserName></xml>'
var builder = new xml2js.Builder({
  rootName: 'xml',
  headless: true,
  cdata: true,
  renderOpts: {
    pretty: true,
    indent: '',
    newline: '' 
  }
});
var xmlData = builder.buildObject(jsonData);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published