
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@prabhatsharma/xml2json
Advanced tools
This is an XML to json converter that provides much more beautiful output than any other javascript converter that Ihave come across. I tried xml2js and others but each one of them gave me unweildy json from xml which was very difficult to read and consume.
I also needed the functionality where I want to skip parsing of a specific tag and return it as it is. This converter has this functionality too.
So here we go!
var fs = require('fs');
const util = require('util')
var parser = require('@prabhatsharma/xml2json')
// var filename = __dirname + '/test-bigfile.xml'
var filename = __dirname + '/test-smallfile.xml'
fs.readFile(filename, function (err, data) {
var xml = data.toString('utf8')
var processedObject = parser.parse(xml, 'text')
console.log( util.inspect(processedObject, {showHidden: false, depth: null}).replace(/([{,])(\s*)([A-Za-z0-9_\-]+?)\s*:/g, '$1"$3":'))
})
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document>
<publisher location="San Francisco">Manning</publisher>
<author>
<firstname aka="Bablu">Prabhat</firstname>
<lastnmame>Sharma</lastnmame>
<text> <p>Something in html</p> </text>
</author>
<books>
<favoriteGenre>12345</favoriteGenre>
<book>
<title>A small book</title>
</book>
<book>
<title>A big book</title>
</book>
</books>
</document>
will result in:
{"publisher": {
"attr": {"location": 'San Francisco' },
"text": 'Manning' },
"author": {
"firstname": {"attr": {"aka": 'Bablu' },"text": 'Prabhat' },
"lastnmame": {"text": 'Sharma' },
"text": '<text> <p>Something in html</p> </text>'
},
"books": {
"favoriteGenre": {"text": '12345' },
"book": [
{"title": {"text": 'A small book' } },
{"title": {"text": 'A big book' } }
]
}
}
FAQs
A beautiful XML to json converter
We found that @prabhatsharma/xml2json 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.