Legacy APIs, RSS feeds, SOAP responses, Maven and .NET config files — XML is still everywhere, and almost every modern tool wants JSON. Here's how to convert it without hand-writing a parser.
transmute parses XML records into JSON directly. Given this file (users.xml):
<data> <user><name>Alice</name><age>32</age></user> <user><name>Bob</name><age>25</age></user> </data>
run:
$ npx github:mahope/transmute users.xml --format xml --pipe '[{"op":"head","n":10}]' --output json [ { "name": "Alice", "age": "32" }, { "name": "Bob", "age": "25" } ]
You can chain operations in the same pass — here filtering and reshaping before output:
$ npx github:mahope/transmute users.xml --format xml --pipe '[{"op":"filter","expr":"Number(item.age) > 26"},{"op":"pick","fields":["name"]}]' --output json [ { "name": "Alice" } ]
import xmltodict, json with open("users.xml") as f: data = xmltodict.parse(f.read()) print(json.dumps(data, indent=2))
pip install xmltodict. Solid, but it's another dependency to pin, and attributes get @-prefixed keys you often have to clean up afterwards.
For a quick one-off, the live demo on the Transmute page converts between formats entirely client-side — nothing is uploaded.
Number(item.age) when you need real numbers.<user id="7"> becomes an "id" field. Check the output once before trusting it in bulk.The Transmute CLI is free (npx github:mahope/transmute). The desktop app adds an interactive pipeline builder, live preview and batch processing — one-time $19, no subscription.
More guides: JSON to XML · A simple jq alternative