
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
xml-to-tree
Advanced tools
A utility for parsing XML strings into a tree structure - safe for fragments and multi-root.
Canonical URL:
https://alexstevovich.com/a/xml-to-tree-nodejs
Software URL:
https://midnightcitylights.com/software/xml-to-tree-nodejs
xml-to-tree is a utility for parsing XML strings into a JSON tree representation. It is safe for XML fragments and multi-root documents, providing a clean structure for each node and its children.
npm install xml-to-tree
import { parse } from 'xml-to-tree';
const xml = `
<book>
<title>XML for Beginners</title>
<author>John Doe</author>
<year>2025</year>
</book>`;
const tree = parse(xml);
console.log(JSON.stringify(tree, null, 2));
parse(xml, options = {})xml: The XML string or fragment to parse.options.tagKey: The key used for the tag name (default is 'tag').options.childrenKey: The key used for child nodes (default is 'children').options.textKey: The key used for text content (default is 'text').Returns a JSON tree representation of the XML. It processes each element node, its attributes, and its child nodes recursively.
Licensed under the MIT License.
FAQs
A utility for parsing XML strings into a tree structure - safe for fragments and multi-root.
We found that xml-to-tree demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.