XML interview question · Most asked

XML, JSON or YAML: how do you choose?

Create a free account to save this page, take notes and track your progress. Sign in

Summary

JSON for web and mobile APIs (simple data, native in JavaScript). YAML or TOML for human-edited configuration. XML for documents with markup (mixed content), standards that mandate it (finance, healthcare, publishing, Office/SVG), strict schema-validated contracts, namespaces for combining vocabularies, and XSLT/XQuery pipelines.

Longer Answer

Converting XML to JSON needs an explicit mapping: generic converters turn one element into an object and two into an array, and lose types.

Key Points

  • JSON: APIs.
  • YAML: config.
  • XML: documents, standards, contracts.
  • Explicit mappings when converting.

Deep dive: XML Tutorial: XML vs JSON vs YAML

Explanation

What interviewers look for

Context-based choice, not dogma.

More most-asked XML questions

← All XML questions

Was this page helpful?