
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Simple JavaScript Object to XML string converter.
Install via npm, which will download json2xml
and all of its dependencies.
npm install json2xml
While the name of the repo is json2xml
, it is really pojo2xml
, since you will need to run JSON.parse
on the JSON data prior to converting.
var fs = require('fs');
var json2xml = require('json2xml');
fs.readFile('data.json', 'utf8', function read (err, data) {
if (err) console.log(err);
fs.writeFile('data.xml', json2xml(JSON.parse(data)));
});
// none:
json2xml({ a: 1 });
//<a>1</a>
// empty node:
json2xml({ a: '' });
//<a/>
// add header:
json2xml({ a: 1 }, { header: true });
//<?xml version="1.0" encoding="UTF-8"?><a>1</a>
// add node attributes:
json2xml({ a: 1, attr: { b: 2, c: 3 } }, { attributes_key: 'attr' });
// <a b="2" c="3" >1</a>
// arrays:
json2xml([ { a: 1 }, { b: 2 } ]);
//'<a>1</a><b>2</b>
json2xml({ 'items': [ { item: 1 }, { item: 2 } ] });
//'<items><item>1</item><item>2</item></items>'
FAQs
Simple JavaScript Object to XML string converter.
The npm package json2xml receives a total of 30,329 weekly downloads. As such, json2xml popularity was classified as popular.
We found that json2xml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.