We break down how to consciously choose between
JSON and
XML: “data vs document”, primitive typing (
true,
123,
"text",
null), lists, attributes, ordering, and schemas/validation. Using Kotlin examples, we show why a
JsonElement tree is convenient for unstable structures, why it’s worth separating parsing from business validation, and why it’s better to generate via
buildJsonObject rather than by concatenating strings.