Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Converts XML to JSON using node-expat
JavaScript
branch: master

This branch is 1 commit ahead, 4 commits behind ql-io:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.npmignore
README.md
index.js
package.json

README.md

Simple SAX-based XML2JSON Parser.

It does not parse the following elements:

  • CDATA sections
  • Processing instructions
  • XML declarations
  • Entity declarations
  • Comments

Installation

npm install xml2json

Usage

var parser = require('xml2json');

var xml = "<foo>bar</foo>";
var json = parser.toJson(xml); //returns an string containing the json structure by default
console.log(json);
  • if you want to get the Javascript object then you might want to invoke parser.toJson(xml, {object: true});
  • if you want a reversible json to xml then you should use parser.toJson(xml, {reversible: true});

License

Copyright 2011 BugLabs Inc. All rights reserved.

Something went wrong with that request. Please try again.