XML and JSON — Advantages and Disadvantages?

前端 未结 8 651
遥遥无期
遥遥无期 2020-12-22 22:12

I recently heard about JavaScript Object Notation (JSON), and after looking it up, it seems like it\'s becoming rather popular as an alternative to the Extensible Markup Lan

相关标签:
8条回答
  • 2020-12-22 22:50

    JSON is a much simpler format than XML. JSON is intended only for describing data as an object hierarchy, while XML has many other features as well.

    If you only need to send plain simple data, then JSON is a good alternative, as that is just what it's intended for.

    If you need a more powerful way of describing your data then you would need XML, as JSON simply doesn't do anything fancy.

    0 讨论(0)
  • 2020-12-22 22:50

    They're equally expressive formats. JSON is less verbose. JSON can be parsed easily in JavaScript (and other languages), and XML is parsed easily by many things too.

    I think the most important consideration is what will be consuming the data - if you already have a bunch of XML-interpreting code, stick with that. If all your clients are web developers, go with JSON.

    0 讨论(0)
提交回复
热议问题