什么时候更喜欢JSON而不是XML?
问题描述:
我的要求就是在展开时显示从数据库中检索的一组值。我正在使用jquery。
My requirement is just to display a set of values retrieved from database on a spread. I am using jquery.
答
当其中任何一个为真时,支持XML over JSON:
Favor XML over JSON when any of these is true:
- 您需要消息验证
- 您正在使用XSLT
- 您的消息包含大量标记文本
- 您需要与不支持JSON的环境进行互操作
- 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
当所有这些都成立时,支持JSON over XML:
Favor JSON over XML when all of these are true:
- 消息不需要验证,或验证它们的反序列化很简单
- 您没有转换消息,或者转换它们的反序列化很简单
- 您的消息主要是数据,而不是标记文本
- 消息传递端点具有良好的JSON工具
- 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