When to prefer JSON over XML?

sarego picture sarego · Nov 28, 2008 · Viewed 36.2k times · Source

My requirement is just to display a set of values retrieved from database on a spread. I am using jquery.

Answer

Robert Rossney picture Robert Rossney · Dec 1, 2008

Favor XML over JSON when any of these is true:

  • You need message validation
  • You're using XSLT
  • Your messages include a lot of marked-up text
  • You need to interoperate with environments that don't support JSON

Favor JSON over XML when all of these are true:

  • Messages don't need to be validated, or validating their deserialization is simple
  • You're not transforming messages, or transforming their deserialization is simple
  • Your messages are mostly data, not marked-up text
  • The messaging endpoints have good JSON tools