What are the advantages of XML over JSON?

In which cases would JSON be preferred over XML?

Beginner Asked on September 19, 2018 in Markup Languages.
Add Comment
1 Answer(s)

First, let’s look over what these two are,in brief.

JSON(JavaScript Object Notation) is used for serialising and transmitting structured data over a network connection.It is an alternative to XML and is used primarily to transmit data between a server and a web application.

XML(Extensible Markup Language)is a document markup based applications as a way to store documents.

Following are the advantages of XML over JSON.

  • Schema support-Since,the data might travel between several system, deviations from the expected format are possible.Hence,XML would not lead to incorrect data,in case of deviations from the defined schema.However,your data may not be processed in JSON under such scenario.
  • Rendering in a highly readable format-The tree structure of XML enables the browser to render the data in a highly readable and organised way.
  • In XML the metadata could be put into the tags in the form of attributes, whereas in JSON the metadata as well as the actual data are wrapped together as an object.

The above features would appear in JSON,but for now XML is preferred format for web services and file formats.JSON is useful while developing a web application where fast, compact and convenient serialization is of data is required.

 

Beginner Answered on September 25, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.