When to prefer JSON over XML?

后端 未结 19 1578
无人共我
无人共我 2020-11-28 00:31

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

19条回答
  •  孤城傲影
    2020-11-28 01:03

    Using JSON

    • If the data is to be consumed by JavaScript in the browser.
    • Data model is simple and not complex(too many composite objects).

    Using XML

    • Mostly in an SOA kind of environment where you are integrating several services on heterogeneous platforms and technologies.
    • SOAP has an advantage that it can be transmitted across different protocols other then HTTP.
    • Easy to use in data model transformation tool like XSLT,XSL-FO etc.
    • Lot of Database support to store/query(XQuery) XML data.
    • XML is a very mature data format so you would find plenty of tools to support any use case that you can think of.

提交回复
热议问题