SlideShare a Scribd company logo
JSON – Java Script Object
Notation
Written By:-Pankaj Srivastava
pankajshrivastav6@gmail.com
What is JSON
 JSON is a data interchange format
 Interactive Web 2.0 applications, no more use page
replacement. Data transfer without refreshing a page.
 The most important aspects of data transfer are
simplicity, extensibility, interoperability, openness and
human readability
 Key idea in AJAX – Asynchronous Java Script and XML.
Topics to cover
 Overview of the working of JSON
 Properties of JSON as a data format
 JSON with AJAX
 Advantages of using JSON with AJAX
 Security Concerns in using JSON
 Where does it fit the best
How does it work?
 JSON is a subset of Java Script. JSON can be parsed by
a Java Script parser.
 It can represent either complex or simple data as it has
data types
 They are Strings, Number, Boolean, Objects and Arrays
 E.g. of Object:
 { "name": "Jack ("Bee") Nimble", "format": { "type":
"rect", "width": 120, "interlace": false}}
 An array can be shown as
 ["Sunday", "Monday", "Tuesday", "Wednesday“]
 All data types are intuitive and similar to other programming
languages
 Also compatible with other languages like C, C++, C#,
ColdFusion, Python and many more.
Properties of JSON
 It's simultaneously human- and machine-
readable format.
 It has support for Unicode, allowing almost
any information in any human language to be
communicated;
 The self-documenting format that describes
structure and field names as well as specific
values.
 The strict syntax and parsing requirements
that allow the necessary parsing algorithms to
remain simple, efficient, and consistent;
 The ability to represent the most general
computer science data structures: records,
lists and trees.
JSON in AJAX
 JSON can be used in AJAX as follows:
 Include it in HTML directly
 <html>... <script> var data = JSONdata; </script>...
</html>
 JSON is used with XMLHttpRequest and can be
converted into a JavaScript structure
 responseData = eval('(' + responseText + ')');
 Another approach is to use an invisible <iframe> for data
communication. The server sends JSON text embedded in a script
in a document.
 <html><head><script> document.domain = ‘something.com’;
parent.deliver(JSONtext); </script></head></html>
 deliver is passed the incoming data structure.
Why is JSON better suited for
AJAX?
 JSON is widely used in AJAX. The X in AJAX stands for
XML.
 E.g.
 {
 "name": “Pankaj Kumar",
 "org": “India",
 }
 <?xml version='1.0‘ encoding='UTF-8'?>
 <element>
 <name>Pankaj Kumatr</name>
 <org>India</org>
 </element>
 JSON response at client side is:
 var name = eval('(' + req.responseText + ')').fullname.value;
 To access a composite element
 eval('(' + req.responseText + ')').xyz.abc.value;
 Thus, any level deep elements can be easily accessed.
 XML response at client side is:
 var root = req.responseXML;
 var name = root.getElementsByTagName(‘fullname’);
 To access a composite element
 root.getElementsByTagName(‘xyz’)[0].firstChild
 To access deeper levels we need more overhead.
 Reduced extensibility in XML
Security Concerns
 Same Origin Policy - JavaScript to access the contents of
a Webpage, both the JavaScript and the Web page must
originate from the same domain.
 Malicious website could serve up JavaScript that loads
sensitive information from other websites using a client's
credentials and communicates it back to the attacker.
 Although the malicious JavaScript can’t directly manipulate the
contents, it can view the execution of the JavaScript and store the
results it returns.
 This problem gets aggravated with JSON as the JSON arrays are
themselves JavaScript objects and any malicious user can view
them directly.
Where can JSON be used?
 JSON is a light weight data format that can be used for
transferring medium amounts of data.
 It can be used in Java Script and then rendered on HTML
pages
 AJAX has many applications for JSON
 Thus, use JSON for applications that are browser based.
References:
 www.json.org
 RFC 4627, Network Working Group D. Crockford
 Thank you

More Related Content

PPT
Json – java script object notation
PPT
java script json
PPT
Java Script Object Notation (JSON)
PDF
Introduction to JSON
Json – java script object notation
java script json
Java Script Object Notation (JSON)
Introduction to JSON

What's hot (20)

PPTX
JSON - (English)
PDF
07 objective-c session 7
PPT
PPTX
Json processing
PDF
An Introduction to JSON JavaScript Object Notation
PDF
Basics of JSON (JavaScript Object Notation) with examples
PDF
Intro to JSON
PPTX
JSON(JavaScript Object Notation)
PDF
Quick overview on mongo db
PPT
NoSQL - "simple" web monitoring
PPT
DOCX
ODP
Xml processing in scala
PPTX
Xml processors
PPTX
Introduction to MongoDB
PPT
Overview on NoSQL and MongoDB
PDF
JSON - (English)
07 objective-c session 7
Json processing
An Introduction to JSON JavaScript Object Notation
Basics of JSON (JavaScript Object Notation) with examples
Intro to JSON
JSON(JavaScript Object Notation)
Quick overview on mongo db
NoSQL - "simple" web monitoring
Xml processing in scala
Xml processors
Introduction to MongoDB
Overview on NoSQL and MongoDB
Ad

Similar to Json – java script object notation (20)

PPT
PPTX
Introduction to JavaScript Object Notation(JSON)
PPTX
PPT
json.ppt download for free for college project
PPTX
LU 1.3. JSON & XML.pptx about how they work and introduction
PPTX
Unit-2.pptx
PPTX
JSON & AJAX.pptx
PPT
Json - ideal for data interchange
PPTX
Json
PPTX
All about XML, JSON and related topics..
PDF
Json
PPTX
JSON.pptx
PPTX
J s o n
PPTX
An introduction to json
PPTX
Intro to JSON
Introduction to JavaScript Object Notation(JSON)
json.ppt download for free for college project
LU 1.3. JSON & XML.pptx about how they work and introduction
Unit-2.pptx
JSON & AJAX.pptx
Json - ideal for data interchange
Json
All about XML, JSON and related topics..
Json
JSON.pptx
J s o n
An introduction to json
Intro to JSON
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?

Json – java script object notation

  • 1. JSON – Java Script Object Notation Written By:-Pankaj Srivastava pankajshrivastav6@gmail.com
  • 2. What is JSON  JSON is a data interchange format  Interactive Web 2.0 applications, no more use page replacement. Data transfer without refreshing a page.  The most important aspects of data transfer are simplicity, extensibility, interoperability, openness and human readability  Key idea in AJAX – Asynchronous Java Script and XML.
  • 3. Topics to cover  Overview of the working of JSON  Properties of JSON as a data format  JSON with AJAX  Advantages of using JSON with AJAX  Security Concerns in using JSON  Where does it fit the best
  • 4. How does it work?  JSON is a subset of Java Script. JSON can be parsed by a Java Script parser.  It can represent either complex or simple data as it has data types  They are Strings, Number, Boolean, Objects and Arrays  E.g. of Object:  { "name": "Jack ("Bee") Nimble", "format": { "type": "rect", "width": 120, "interlace": false}}
  • 5.  An array can be shown as  ["Sunday", "Monday", "Tuesday", "Wednesday“]  All data types are intuitive and similar to other programming languages  Also compatible with other languages like C, C++, C#, ColdFusion, Python and many more.
  • 6. Properties of JSON  It's simultaneously human- and machine- readable format.  It has support for Unicode, allowing almost any information in any human language to be communicated;  The self-documenting format that describes structure and field names as well as specific values.  The strict syntax and parsing requirements that allow the necessary parsing algorithms to remain simple, efficient, and consistent;  The ability to represent the most general computer science data structures: records, lists and trees.
  • 7. JSON in AJAX  JSON can be used in AJAX as follows:  Include it in HTML directly  <html>... <script> var data = JSONdata; </script>... </html>  JSON is used with XMLHttpRequest and can be converted into a JavaScript structure  responseData = eval('(' + responseText + ')');
  • 8.  Another approach is to use an invisible <iframe> for data communication. The server sends JSON text embedded in a script in a document.  <html><head><script> document.domain = ‘something.com’; parent.deliver(JSONtext); </script></head></html>  deliver is passed the incoming data structure.
  • 9. Why is JSON better suited for AJAX?  JSON is widely used in AJAX. The X in AJAX stands for XML.  E.g.  {  "name": “Pankaj Kumar",  "org": “India",  }  <?xml version='1.0‘ encoding='UTF-8'?>  <element>  <name>Pankaj Kumatr</name>  <org>India</org>  </element>
  • 10.  JSON response at client side is:  var name = eval('(' + req.responseText + ')').fullname.value;  To access a composite element  eval('(' + req.responseText + ')').xyz.abc.value;  Thus, any level deep elements can be easily accessed.
  • 11.  XML response at client side is:  var root = req.responseXML;  var name = root.getElementsByTagName(‘fullname’);  To access a composite element  root.getElementsByTagName(‘xyz’)[0].firstChild  To access deeper levels we need more overhead.  Reduced extensibility in XML
  • 12. Security Concerns  Same Origin Policy - JavaScript to access the contents of a Webpage, both the JavaScript and the Web page must originate from the same domain.  Malicious website could serve up JavaScript that loads sensitive information from other websites using a client's credentials and communicates it back to the attacker.
  • 13.  Although the malicious JavaScript can’t directly manipulate the contents, it can view the execution of the JavaScript and store the results it returns.  This problem gets aggravated with JSON as the JSON arrays are themselves JavaScript objects and any malicious user can view them directly.
  • 14. Where can JSON be used?  JSON is a light weight data format that can be used for transferring medium amounts of data.  It can be used in Java Script and then rendered on HTML pages  AJAX has many applications for JSON  Thus, use JSON for applications that are browser based.
  • 15. References:  www.json.org  RFC 4627, Network Working Group D. Crockford  Thank you