4

I am trying to understand which of these two technologies, XML or JSON, is better to use for data from a DB. I need to parse data from one of these files and use it my program. And I am trying to see which APIs should I consider for ease of use and design perspective.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
nek
  • 157
  • 1
  • 1
  • 4

1 Answers1

4

Choose XML if

  • There's already an industry standard XSD to follow.
  • Validation afforded by creating a new XSD is important to you or your callers.
  • You need to transform the data to another XML form. (XSLT works wonders for transformations.)
  • Or, you have to represent mixed content (tags mixed within text).

Choose JSON if

  • The closer fit to JavaScript is valuable to you or your callers.
  • You prefer a lighter-weight solution.
  • Or, the reasons mentioned above for choosing XML do not apply to you.
kjhughes
  • 106,133
  • 27
  • 181
  • 240