Ajax response – XML vs JSON

Ajax response data can be any format like HTML, XML, JSON.  Below are some comparisons of XML & JSON.


  • XML parsing is generic.
  • XML is a markup language and has semantics.
  • XML is most easily readable format for humans.
  • Easily validate the data using schema.


  • JSON data is faster than XML over the Http.
  • Scripts for JSON data are simpler than XML.
  • For i18n,  JSON seems to be an easy one.
  • Its very hard to read humans.

To conclude, based on your requirements you can choose the format either XML or JSON.

If you are new to Ajax or JSON. Kindly read the below links for learning basics.

Ajax – https://manikandanmv.wordpress.com/2008/09/23/ajax-asynchronous-javascript-and-xml/

JSON – https://manikandanmv.wordpress.com/2008/10/08/json-java-script-object-notation/

Tags: , , , , , , ,

4 Responses to “Ajax response – XML vs JSON”

  1. Miro Says:

    For me have cases when JSON is better, but have other cases when XML is better in AJAX

  2. Miro Says:

    JSON is better for using from JavaScript

  3. manikandanmv Says:

    absolutely right miro, using javascript you can easily parse the JSON data from client side.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: