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
Web Development Course - AJAX & JSON by RSOLUTIONS
PPTX
Json
PPTX
Introduction to JSON & AJAX
PPTX
Web creation languages : Jason Learn Jason
PPTX
AJAX and JSON
DOCX
Copy of ajax tutorial
PPTX
Web Fundamentals: JavaScript Objects Json and XML
PPTX
Working with XML and JSON Serializing
PPT
Java Script Based Client Server Webapps 2
PDF
CS8651 IP Unit 2 pdf regulation -2017 anna university
PPTX
Jason programming object oriented programming it- Updated.pptx
PPT
Ajax Lecture Notes
PDF
JSON Fuzzing: New approach to old problems
PPTX
PPTX
JSON & AJAX.pptx
PDF
Software development - the java perspective
Web Development Course - AJAX & JSON by RSOLUTIONS
Json
Introduction to JSON & AJAX
Web creation languages : Jason Learn Jason
AJAX and JSON
Copy of ajax tutorial
Web Fundamentals: JavaScript Objects Json and XML
Working with XML and JSON Serializing
Java Script Based Client Server Webapps 2
CS8651 IP Unit 2 pdf regulation -2017 anna university
Jason programming object oriented programming it- Updated.pptx
Ajax Lecture Notes
JSON Fuzzing: New approach to old problems
JSON & AJAX.pptx
Software development - the java perspective
Ad

Recently uploaded (20)

PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
August Patch Tuesday
PDF
Getting Started with Data Integration: FME Form 101
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Unlock new opportunities with location data.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Modernising the Digital Integration Hub
DOCX
search engine optimization ppt fir known well about this
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Five Habits of High-Impact Board Members
PDF
sustainability-14-14877-v2.pddhzftheheeeee
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
August Patch Tuesday
Getting Started with Data Integration: FME Form 101
CloudStack 4.21: First Look Webinar slides
Developing a website for English-speaking practice to English as a foreign la...
Unlock new opportunities with location data.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Modernising the Digital Integration Hub
search engine optimization ppt fir known well about this
observCloud-Native Containerability and monitoring.pptx
Benefits of Physical activity for teenagers.pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
Hindi spoken digit analysis for native and non-native speakers
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
A review of recent deep learning applications in wood surface defect identifi...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Five Habits of High-Impact Board Members
sustainability-14-14877-v2.pddhzftheheeeee

Json – java script object notation

  • 1. JSON – Java Script Object Notation Written By:-Pankaj Srivastava [email protected]
  • 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