README
Parse xml into json or the inverse.
Install
npm install xma
Usage
const { parseXml, buildXml } = require("xma");
parseXml("<root>Hello World</root>");
//=> { root: "Hello World" }
parseXml(`<root foo="bar">Hello World</root>`);
//=> { root: { _: "Hello World", $: { foo: "bar" } } }
buildXml({ root: "Hello World" });
//=> "<root>Hello World</root>"
buildXml({ root: { _: "Hello World", $: { foo: "bar" } } });
//=> "<root foo="bar">Hello World</root>"
API
parseXml(xmlString, options?)
Parse xml into json.
xmlString
Type: string
The xml to parse.
options
Type: object
The options to pass to xml2js.
buildXml(xmlObject, options?)
Build xml from json.
xmlObject
Type: string
The json object to build.
options
Type: object
The options to pass to xml2js.