When to prefer JSON over XML?

后端 未结 19 1586
无人共我
无人共我 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:01

    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

提交回复
热议问题