Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xml2json

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml2json

Converts xml to json using node-expat.

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
88K
increased by0.11%
Maintainers
0
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 07 Jul 2011

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc