Tuesday, 27 September 2016

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

FeaturesJSONXML
Full FormJavaScript Object NotationExtensible Markup Language
ExtendExtended from JavaScriptExtended from SGML(Standard Generalized Markup Language)
SpeedFaster in ExecutionSlow compared to JSON in Execution
Arrays UsageUses Structured Data Excepting ArraysUses Structured Data Including Arrays
ApplicationFor WebService, JSON is better.For Configuration, XML is better
Example
CommentsNot Supports Comments Supports Comments
NameSpaceNo support for Namespaces Support Namespaces
APIsFacebook Graph API, Google Maps API, Twitter API, Pinterest API,Reddit APIAmazon Products Advertising API
PerformanceGood Compared to XMLNot as good when Compared to JSON
PurposeStructured Data InterchangeDocument Markup
Database SupportMongoDB, CouchDB, eXistDB, BaseX, Oracle Database, PostgreSQLMySQL, IBM DB2, Mocrosoft SQL Server, BaseX, MarkLogics
Light WeightLighter than XMLLess Light compared to JSON
SchemaFor Description and DataType and Structure ValidationFor DataType, Structure Validation, It also makes possible to create new DataTypes
Easy to ManipulateYesNo
SecurityMore SecureLess 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

No comments:

Post a Comment