How JSON and XML model data differently
JSON and XML both describe hierarchical data, but their type systems are not the same. JSON has a small set of native types — strings, numbers, booleans, null, objects, and arrays — and a parser hands them back with those types intact. XML has exactly one primitive: text. Everything in an XML document is an element, an attribute, or a text node, and a bare parser sees "184.5" and "true" as strings until a schema or your own code says otherwise.
That gap drives every decision this converter makes. A JSON key maps cleanly to an element name, and a nested object maps to a nested element, because both are just named containers. Scalar values, however, have to collapse into text content: the number 184.5 and the boolean true are emitted exactly as they read, with no quotes and no type marker. If a downstream system needs to know that a field is numeric or boolean, it must apply an XML Schema or cast the values itself after parsing.
XML also carries features that have no JSON counterpart — attributes, namespaces, processing instructions, comments, and mixed content where text and elements interleave. A one-way JSON-to-XML mapping cannot invent meaning for those, so it produces a deliberately plain, element-only document that stays predictable and easy to reason about.