parse xml into json and back
// output appears here
curl -sX POST 'https://api.whittly.dev/v1/xml/to-json' \
-H 'Authorization: Bearer $WHITTLY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"input":"<root><item id=\"1\">hello</item></root>"}'
const res = await fetch('https://api.whittly.dev/v1/xml/to-json', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ input: "<root><item id=\"1\">hello</item></root>" }),
});
const data = await res.json();
const { data } = await axios.post(
'https://api.whittly.dev/v1/xml/to-json',
{ input: "<root><item id=\"1\">hello</item></root>" },
{ headers: { Authorization: 'Bearer ' + apiKey } }
);
XML and JSON are both widely used data serialization formats. XML is common in SOAP APIs, configuration files, and document formats; JSON dominates REST APIs and JavaScript ecosystems. This tool converts between them while handling attributes, namespaces, and arrays.