JSON ( Javascript Object Notation ) is more often used than XML because it is lightweight, and native Javascript.
That being said, if what you need is XML, then you would pull back XML.
Here's a good page on when to use HTML, XML or JSON
Here's a good page on the differences between the two.
JSON is used for performance reasons, mostly. To use the example from that page:
XML:
<?xml version=’1.0′ encoding=’UTF-8′?>
<card>
<fullname>Bala Arjunan</fullname>
<org>PH</org>
<emailaddrs>
<address type=’work’>[email protected]</address>
<address type=’home’ pref=’1′>[email protected]</address>
</emailaddrs>
<telephones>
<tel type=’work’ pref=’1′>+12345678</tel>
<tel type=’mobile’>+1234 1234</tel>
</telephones>
<addresses>
<address type=’work’ format=’B'>1234 Oil Mill St Chennai, IND</address>
<address type=’home’ format=’B'>5678 Oil Mill St Chennai, IND</address>
</addresses>
<urls>
<address type=’work’>http://balaarjunan.wordpress.com/</address>
<address type=’home’>http://balaarjunan.wordpress.com/</address>
</urls>
</card>
JSON:
{
“fullname”: “Bala Arjunan”,
“org”: “PH”,
“emailaddrs”: [
{"type": "work", "value": "[email protected]"},
{"type": "home", "pref": 1, "value": "[email protected]"}
],
“telephones”: [
{"type": "work", "pref": 1, "value": "+12345678"},
{"type": "mobile", "value": "+1234 1234"}
],
“addresses”: [
{"type": "work", "format": "us", "value": "1234 Oil Mill St Chennai, IND"},
{"type": "home", "format": "us", "5678 Oil Mill St Chennai, IND"}
],
“urls”: [
{"type": "work", "value": "http://balaarjunan.wordpress.com/"},
{"type": "home", "value": "http://balaarjunan.wordpress.com/"}
]
}
With JSON, there is far less redundancy.
OTOH, sending plain ol' HTML is very effective at times as well. You have to think about your data. If you're just updating a paragraph of text, just send html through. IF you're dealing with items, or a collection of items that you're going to manipulate or use somehow in Javascript, you want JSON. If you want to ASyncronously update your RSS Feed or some other XML, you ask for XML.
Remember, HTML is just a subset of XML. and xHTML follows all the xml rules. Browsers that are javascript aware ( all of them ) can understand JSON ( Javascript ) and HTML (XML). Choose what fits your project based on how you will use the data.