JSON is lighter and maps directly to objects; XML supports attributes and namespaces.
<!-- XML -->
<user><name>Alice</name><active>true</active></user>
<!-- JSON -->
{"name": "Alice", "active": true}Use JSON for APIs and JavaScript apps, XML for documents with metadata.