Skip to content

anubhawps/node-xml2json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>";
parser.toJson(xml, options, function(err, data){
	if(err) throw err;
	console.log(data);
}); 
  • if you want to get the Javascript object then you might want to invoke parser.toJson(xml, {object: true},callback);
  • if you want a reversible json to xml then you should use parser.toJson(xml, {reversible: true}, callback);

License

Copyright 2011 BugLabs Inc. All rights reserved.

About

Converts XML to JSON using node-expat

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%