SlideShare a Scribd company logo
1 of 29
Data Exchange Over Internet
JSON vs XML
University of Engineering and Technology,
Lahore
• Introduction
• Syntax
• Tree
• Namespace
• Datatypes Supported
• Parser
• Data Access
• XPath
• XQuery
• Introduction
• Syntax
• Datatypes Supported
• Arrays
• Objects
• Parser
• Data Access
JSON
Shahzaib Tariq
2018-CS-130
What is JSON?
Let’s get familiar with JavaScript Object Notation
1
 JSON is a format/syntax
for storing and
exchanging data.
 JSON is text, written with
JavaScript object
notation.
Breif Description
 JSON is a lightweight
data-interchange format
 JSON is "self-describing"
and easy to understand
 JSON is language
independent *
 Data is in name/value
pairs
 Data is separated by
commas
 Curly braces hold objects
 Square brackets hold
arrays
Syntax
 Data Types JSON support:
• string
• number
• object (JSON object)
• array
• boolean
Data-Type
• date
• time
• null
 JSON objects are
surrounded by curly
braces { }.
 JSON objects are written
in key/value pairs.
 Keys must be strings, and
values must be a valid
JSON data type.
 Keys and values are
separated by a colon.
DataTypes - Objects
 Each key/value pair is
separated by a comma.
 Arrays in JSON are almost
the same as arrays in
JavaScript.
 In JSON, array values
must be of type string,
number, object, array,
boolean or null.
DataTypes - Arrays
 When receiving data
from a web server, the
data is always a string.
 Parse the data with
JSON.parse(), and the
data becomes a
JavaScript object.
Parser
Data Access
XML
Ghufran Jaleel
2018-CS-126
What is XML?
Let’s get familiar with Extensible Markup
Language
2
 XML is a markup
language much like
HTML
 XML was designed to
store and transport data
 HTML was designed to
display data elegently
Breif Description
 XML Separates Data from
Presentation
 XML is Often a
Complement to HTML
 XML Separates Data from
HTML
 XML documents are
formed as element trees
 An XML tree starts at a
root element and
branches from the root
to child elements
 All elements can have
sub elements (child
elements)
Syntax - Tree
 XML may have conflict in
tags - They are defined
by developer
 When using prefixes in
XML, a namespace for
the prefix must be
defined.
 The namespace
declaration has the
following syntax.
xmlns:prefix="URI".
Syntax - Namespace
 Primitive types XML
support:
• string
• decimal
• integer
• boolean
• date
• time
Data-Type
 Supports many complex
data types including:
• charts
• graphs
• images
 Before an XML document
can be accessed, it must
be loaded into an XML
DOM object.
 All modern browsers
have a built-in XML
parser that can convert
text into an XML DOM
object.
Parser
Data Access - XPath
 XQuery is the language
for querying XML data
 XQuery for XML is like
SQL for databases
 XQuery is built on XPath
expressions
 XQuery is supported by
all major databases
Data Access - XQuery
Conclusion
M. Wajahat Shahid
2018-CS-113
Performance Comparision
Comparision of Features and Usage
3
Features of JSON
⬥ Usage is Straight-Forward
⬥ No need to create a Mapping
⬥ Better Performance
⬥ Clean Data Format
⬥ No Dependency
Features of XML
⬥ Styled Processed Data can be Displayed by
XSLT
⬥ Meta-Data can also be defined (DTD)
⬥ Provide Namespace for Accurate Results
⬥ Used in Information Exchanges like b2b
transactions and b2c Transactions
⬥ Automated Tasks
⬥ InBuilt Error Handling
 Easy to grasp
 Creation and Manipulation
are Easy and Light-Weight
 All major languages
frameworks support JSON
 Transmission and
Serialization of the
Structured Data are done
using a Network Connection
Pros and Cons of JSON
 JSON offers poor
Extensibility as no
Namespace Support
 State Can not be
Transferred
 XML exchanges Data
between different
platforms. So, it connects
different Systems and
Applications
 XML Separates the Data
from HTML
 XML Simplifies the Platform
Change Process
 Secure Data Transfer
Pros and Cons of XML
 XML requires processing
application
 XML syntax can
sometimes be confusing
as it is similar to other
alternatives
 No intrinsic/primitive
data type support
 The XML syntax is
redundant
 Scripting Language
 Document-Oriented
 Data is stored as Tree
 Bulky and Slow
 Stored data can be
Processed Natively
 Comments are Valid
 XML supports UTF-8 and
UTF-16 encodings
Which is used Where?
 File Format based on
Javascript
 Data-Oriented
 Key-Value Pair
 Fast and Reliable
 No Processing is Avialable
 Supports no Comments
 JSON supports UTF as well as
ASCII encodings.
 Saperate Tags are used for
each Item to use Array
 XML can display with
Elegent Styling
 JSON is supported by most
browsers
 Supports Statefull Data
Exchange
 Mostly used in SOAP APIs
Which is used Where?
 Support Array as in
JavaScript
 JSON has no display
capabilities
 Cross-browser XML parsing
can be tricky
 State can not be preserved
in JSON
 Rest APIs mainly has JSON
response
 Simple Object Access
Protocol
 Data Transfer between
Programs built on different
Platforms and Programming
Languages
 SOAP is it’self a Protocol
 SOAP only works with XML
A Bird-Eye Overview
 Representational State
Transfer
 Deals with Files, Media
Components, or even Objects
on a Particular Hardware
Device
 Use HTTP verbs of GET, POST,
PUT and DELETE for working
 Plain Text, XML, HTML and
JSON. Rest APIs mainly has
JSON response

More Related Content

What's hot

What's hot (20)

XML
XMLXML
XML
 
Xml databases
Xml databasesXml databases
Xml databases
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Xml
XmlXml
Xml
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Intro xml
Intro xmlIntro xml
Intro xml
 
Xml processors
Xml processorsXml processors
Xml processors
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
 
Xml basics for beginning
Xml basics for beginningXml basics for beginning
Xml basics for beginning
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
 
Intro to XML in libraries
Intro to XML in librariesIntro to XML in libraries
Intro to XML in libraries
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
 
Markup Languages
Markup Languages Markup Languages
Markup Languages
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Similar to Data exchange over internet (XML vs JSON)

eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
Aditya Raj
 
ravenbenweb xml and its application .PPT
ravenbenweb xml and its application .PPTravenbenweb xml and its application .PPT
ravenbenweb xml and its application .PPT
ubaidullah75790
 
Data interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTDData interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTD
AnushaMahmood
 

Similar to Data exchange over internet (XML vs JSON) (20)

Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
 
XML1.pptx
XML1.pptxXML1.pptx
XML1.pptx
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
 
What is xml
What is xmlWhat is xml
What is xml
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
Xml and webdata
Xml and webdataXml and webdata
Xml and webdata
 
XML
XMLXML
XML
 
XML
XMLXML
XML
 
Web based application of Live Scoreboard using XML.
Web based application of Live Scoreboard using XML.Web based application of Live Scoreboard using XML.
Web based application of Live Scoreboard using XML.
 
ravenbenweb xml and its application .PPT
ravenbenweb xml and its application .PPTravenbenweb xml and its application .PPT
ravenbenweb xml and its application .PPT
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
Data interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTDData interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTD
 
Json processing
Json processingJson processing
Json processing
 
Xml programming language myassignmenthelp.net
Xml programming  language myassignmenthelp.netXml programming  language myassignmenthelp.net
Xml programming language myassignmenthelp.net
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

Data exchange over internet (XML vs JSON)

  • 1. Data Exchange Over Internet JSON vs XML University of Engineering and Technology, Lahore
  • 2. • Introduction • Syntax • Tree • Namespace • Datatypes Supported • Parser • Data Access • XPath • XQuery • Introduction • Syntax • Datatypes Supported • Arrays • Objects • Parser • Data Access
  • 4. What is JSON? Let’s get familiar with JavaScript Object Notation 1
  • 5.  JSON is a format/syntax for storing and exchanging data.  JSON is text, written with JavaScript object notation. Breif Description  JSON is a lightweight data-interchange format  JSON is "self-describing" and easy to understand  JSON is language independent *
  • 6.  Data is in name/value pairs  Data is separated by commas  Curly braces hold objects  Square brackets hold arrays Syntax
  • 7.  Data Types JSON support: • string • number • object (JSON object) • array • boolean Data-Type • date • time • null
  • 8.  JSON objects are surrounded by curly braces { }.  JSON objects are written in key/value pairs.  Keys must be strings, and values must be a valid JSON data type.  Keys and values are separated by a colon. DataTypes - Objects  Each key/value pair is separated by a comma.
  • 9.  Arrays in JSON are almost the same as arrays in JavaScript.  In JSON, array values must be of type string, number, object, array, boolean or null. DataTypes - Arrays
  • 10.  When receiving data from a web server, the data is always a string.  Parse the data with JSON.parse(), and the data becomes a JavaScript object. Parser
  • 13. What is XML? Let’s get familiar with Extensible Markup Language 2
  • 14.  XML is a markup language much like HTML  XML was designed to store and transport data  HTML was designed to display data elegently Breif Description  XML Separates Data from Presentation  XML is Often a Complement to HTML  XML Separates Data from HTML
  • 15.  XML documents are formed as element trees  An XML tree starts at a root element and branches from the root to child elements  All elements can have sub elements (child elements) Syntax - Tree
  • 16.  XML may have conflict in tags - They are defined by developer  When using prefixes in XML, a namespace for the prefix must be defined.  The namespace declaration has the following syntax. xmlns:prefix="URI". Syntax - Namespace
  • 17.  Primitive types XML support: • string • decimal • integer • boolean • date • time Data-Type  Supports many complex data types including: • charts • graphs • images
  • 18.  Before an XML document can be accessed, it must be loaded into an XML DOM object.  All modern browsers have a built-in XML parser that can convert text into an XML DOM object. Parser
  • 19. Data Access - XPath
  • 20.  XQuery is the language for querying XML data  XQuery for XML is like SQL for databases  XQuery is built on XPath expressions  XQuery is supported by all major databases Data Access - XQuery
  • 23. Features of JSON ⬥ Usage is Straight-Forward ⬥ No need to create a Mapping ⬥ Better Performance ⬥ Clean Data Format ⬥ No Dependency
  • 24. Features of XML ⬥ Styled Processed Data can be Displayed by XSLT ⬥ Meta-Data can also be defined (DTD) ⬥ Provide Namespace for Accurate Results ⬥ Used in Information Exchanges like b2b transactions and b2c Transactions ⬥ Automated Tasks ⬥ InBuilt Error Handling
  • 25.  Easy to grasp  Creation and Manipulation are Easy and Light-Weight  All major languages frameworks support JSON  Transmission and Serialization of the Structured Data are done using a Network Connection Pros and Cons of JSON  JSON offers poor Extensibility as no Namespace Support  State Can not be Transferred
  • 26.  XML exchanges Data between different platforms. So, it connects different Systems and Applications  XML Separates the Data from HTML  XML Simplifies the Platform Change Process  Secure Data Transfer Pros and Cons of XML  XML requires processing application  XML syntax can sometimes be confusing as it is similar to other alternatives  No intrinsic/primitive data type support  The XML syntax is redundant
  • 27.  Scripting Language  Document-Oriented  Data is stored as Tree  Bulky and Slow  Stored data can be Processed Natively  Comments are Valid  XML supports UTF-8 and UTF-16 encodings Which is used Where?  File Format based on Javascript  Data-Oriented  Key-Value Pair  Fast and Reliable  No Processing is Avialable  Supports no Comments  JSON supports UTF as well as ASCII encodings.
  • 28.  Saperate Tags are used for each Item to use Array  XML can display with Elegent Styling  JSON is supported by most browsers  Supports Statefull Data Exchange  Mostly used in SOAP APIs Which is used Where?  Support Array as in JavaScript  JSON has no display capabilities  Cross-browser XML parsing can be tricky  State can not be preserved in JSON  Rest APIs mainly has JSON response
  • 29.  Simple Object Access Protocol  Data Transfer between Programs built on different Platforms and Programming Languages  SOAP is it’self a Protocol  SOAP only works with XML A Bird-Eye Overview  Representational State Transfer  Deals with Files, Media Components, or even Objects on a Particular Hardware Device  Use HTTP verbs of GET, POST, PUT and DELETE for working  Plain Text, XML, HTML and JSON. Rest APIs mainly has JSON response

Editor's Notes

  1. (XML Saparates Data from Presentation) XML does not carry any information about how to be displayed. The same XML data can be used in many different presentation scenarios. (XML is Complement toHTML) In many HTML applications, XML is used to store or transport data, while HTML is used to format and display the same data. (XML Saperate Data from HTML) When displaying data in HTML, you should not have to edit the HTML file when the data changes. With XML, the data can be stored in separate XML files. With a few lines of JavaScript code, you can read an XML file and update the data content of any HTML page.
  2. Extensible Style Language Transformer Document Type Defination
  3. Rest Architectural Fearure Client Server Stateless Cacheable Layered System Uniform Interface