ADVERTISEMENT
ADVERTISEMENT

Home » JSON

XML vs JSON | Differences between XML and JSON

XML vs JSON: In this tutorial, we are going to learn about the XML and JSON, what are the differences between XML and JSON?
Submitted by Siddhant Verma, on November 10, 2019

XML

XML stands for "Extensible Markup Language". We have already seen JSON previously now let's talk a little bit about XML even though it's mostly depreciated now and compare it with JSON later on.

XML was developed in 1997. This was the time Web Development had just started getting out there and this kind of data formal was widely accepted back then. This was because it could be closely associated with HTML and web sites used HTML extensively. Back then if you knew HTML in and out, you were a pro. XML is not just a data format, it is a language in itself or more precisely a markup language like HTML. Its purpose is to store and transmit data.

<note>
    <to>Jimmy</to>
    <from>Sushi</from>
    <heading>Reminder!</heading>

    <body>Remember to water the plants</body>
</note>

Above is an example of some data stored in XML. The thing about XML was that it provided data which was very descriptive and yes, back then it seemed great. You get some data that tells you what it is until people realized the extra information wasn't needed anymore.

It has 4 parts: information about where the data is being sent from and to where, a heading and a body.

Another problem was that XML would sit there and do absolutely nothing if it was not consumed somewhere as in some software or application. That seems absurd for data so descriptive. It was preferred because it was easy to use, simple and did not use predefined tags.

JSON

After JSON entered in 2001, it started becoming very popular because of its similarity with JavaScript. Js was also becoming super popular back then. Let's see some notable differences between the two.

Differences between XML and JSON

JSON XML
Lightweight and simple to read and write. Less simple than JSON.
Supports array data structure. Does not support any data structure.
More human readable. Less human readable.
Has no display capabilities. Has capabilities to display.
Syntax pertains to JavaScript. Syntax pertains to HTML.
Native object support. No native object support.
No support for namespaces. Supports namespaces.
UTF-8 encoding. Multiple encoding forms.

Both of them are similar in the sense that they support internationalization and Unicode, represent self-describing data and are not dependent on any language.

Due to JSON's lightweight nature and similarity with JavaScript, it is widely used today as a replacement for XML.

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.