JSON vs XML

In Web Application Development, we use different types of formats for accessing a data over the web. Today, we will compare two different formats JSON (JavaScript Object Notation) and XML (Extensible Markup Language). Both have their particular usage for to & fro data passing.

JSON (JavaScript Object Notation) – A model of efficiency

  • A Lightweight text-based open designed for human – readable data interchange manner.

  • It is an alternative to XML that is more efficient because it is not a markup language that requires open and close tags.

  • It is extended from JavaScript.

  • Example :

XML (Extensible Markup Language) – A Data stuffed

  • An Open Standard for describing data defined by the www (world wide web).

  • It defines mark-up language that allows the developer to certain HTML tags type codes.

  • Example:

Difference between XML vs JSON

Features JSON XML
Full Form JavaScript Object Notation Extensible Markup Language
Extend Extended from JavaScript Extended from SGML(Standard Generalized Markup Language)
Speed Faster in Execution Slow compared to JSON in Execution
Arrays Usage Uses Structured Data Excepting Arrays Uses Structured Data Including Arrays
Application For WebService, JSON is better. For Configuration, XML is better
Example
Comments Not Supports Comments  Supports Comments
NameSpace No support for Namespaces  Support Namespaces
APIs Facebook Graph API, Google Maps API, Twitter API, Pinterest API,Reddit API Amazon Products Advertising API
Performance Good Compared to XML Not as good when Compared to JSON
Purpose Structured Data Interchange Document Markup
Database Support MongoDB, CouchDB, eXistDB, BaseX, Oracle Database, PostgreSQL MySQL, IBM DB2, Mocrosoft SQL Server, BaseX, MarkLogics
Light Weight Lighter than XML Less Light compared to JSON
Schema For Description and DataType and Structure Validation For DataType, Structure Validation, It also makes possible to create new DataTypes
Easy to Manipulate Yes No
Security More Secure Less Secure

Choose wisely between JSON & XML. There are some good reasons for using JSON over XML & vice versa. JSON is a better data exchange format. XML is a better document exchange format. Use the right one for the right job

 

Regards

Anand Pandey

Advertisements
Categories:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s