Skip to content
yutils
Example

Input (XML)

<user>
  <name>yutils</name>
  <tags>
    <tag>tools</tag>
    <tag>dev</tag>
  </tags>
</user>

Output (JSON)

{
  "user": {
    "name": "yutils",
    "tags": {
      "tag": ["tools", "dev"]
    }
  }
}

Note

Repeating tags (`<tag>`) become arrays. Attributes appear as `@_attr` (configurable). Round-trip conversion supported.

Usage / FAQ

When to use

  • Feed legacy SOAP / RSS / sitemap.xml data into a JSON pipeline
  • Convert JSON to XML for systems that still require XML (rare but real)
  • Quickly inspect XML from Android, iOS, or older enterprise systems
  • Cross-convert OpenAPI / AsyncAPI XML and JSON definitions
  • Normalize scraped XML to JSON for downstream `jq` processing

FAQ

Q.How are attributes represented?
A.As keys prefixed with `@_` (e.g. `<a href="...">` becomes `{"a": {"@_href": "..."}}`). The prefix is configurable.
Q.What if a repeating tag only appears once?
A.By default it becomes a single object. Enable always-array mode if you want it forced into an array — downstream code stays consistent.
Q.What about comments and CDATA?
A.Dropped by default. Enable the preservation option to keep them as separate fields.
Fun facts
  • 1:1 conversion between XML and JSON is fundamentally impossible — XML's attributes, namespaces, comments, and mixed content don't map cleanly onto JSON. Most converters reach for conventions (e.g., attributes become `@name` keys) and still lose information on round-trip.

    W3C — XML 1.0
  • Moving from SOAP (XML-based RPC) to REST (typically JSON) was the biggest web-API paradigm shift of the 2010s. SOAP's heavy envelope (multi-KB overhead) lost decisively to JSON's lightness in the mobile era — Twitter's 2018 SOAP shutdown is a fitting capstone.

    Wikipedia — SOAP
  • JSON dominates web APIs, but XML still rules publishing — RSS, Atom, EPUB, DocBook, Office Open XML (a .docx is a zipped XML bundle). The clean split between 'structured content' (XML) and 'data interchange' (JSON) has settled.

    Wikipedia — XML applications