🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

xml-mapping

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml-mapping

provide a bidirectionnal mapping between XML and JS data Structure (aka JSON)

1.0.0
Source
npm
Version published
Weekly downloads
4K
6.05%
Maintainers
1
Weekly downloads
 
Created
Source

xml2json and json2xml for NodeJS

It's native javascript implementation of bidirectionnal mapping between XML and JS data structure (aka JSON)", You can convert any type of XML documents in an Javascript data structure. You can also do the reverse, converting a Javascript data structure in XML String. XML is still valid.

Installation

With npm do:

$ npm install xml-mapping

Usage

var xm = require('xml-mapping');

var json = xm.load('<key>value</key>');
var xml  = xm.dump(json);

console.log(xml,json);
console.log(json);

Output:

<key>value</key> { key: { '$t': 'value' } }

Tests

Use nodeunit to run the tests.

$ npm install nodeunit
$ nodeunit test

API Documentation

load(String xml)

Transform a string with XML in Javascript data structure (JSON). Return Object.

dump(Object json)

Transform a Javascript data structure (JSON) in XML string. Return String.

tojson(String xml)

Alias of load.

toxml(Object json)

Alias of dump.

Also

License

MIT/X11

Keywords

xml

FAQs

Package last updated on 22 Feb 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts