SlideShare a Scribd company logo
JSON – Java Script Object
Notation
Dilip Kumar Gupta
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.
 {
 "fullname": "Swati Kumar",
 "org": "Columbia",
 }
 <?xml version='1.0‘ encoding='UTF-8'?>
 <element>
 <fullname>Swati Kumar</fullname>
 <org>Columbia</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

What's hot (20)

PDF
07 objective-c session 7
Amr Elghadban (AmrAngry)
 
PPT
Overview on NoSQL and MongoDB
harithakannan
 
PDF
Quick overview on mongo db
Eman Mohamed
 
PPT
Json
mussawir20
 
PPTX
Json processing
Ahmed Gamil
 
PDF
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
PDF
Intro to JSON
George McKinney
 
PPT
NoSQL - "simple" web monitoring
Samir Siqueira
 
DOCX
Unit 2.3
Abhishek Kesharwani
 
PPT
Json
elliando dias
 
PDF
An Introduction to JSON JavaScript Object Notation
Ahmed Muzammil
 
PPTX
Cordova training : Day 4 - Advanced Javascript
Binu Paul
 
PDF
Unit 2.3
Abhishek Kesharwani
 
ODP
Xml processing in scala
Knoldus Inc.
 
PPTX
Mongo db – document oriented database
Wojciech Sznapka
 
PPTX
Xml processors
Saurav Mawandia
 
PPTX
JSON(JavaScript Object Notation)
Raghu nath
 
PPTX
NoSQL Endgame DevoxxUA Conference 2020
Thodoris Bais
 
07 objective-c session 7
Amr Elghadban (AmrAngry)
 
Overview on NoSQL and MongoDB
harithakannan
 
Quick overview on mongo db
Eman Mohamed
 
Json processing
Ahmed Gamil
 
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
Intro to JSON
George McKinney
 
NoSQL - "simple" web monitoring
Samir Siqueira
 
An Introduction to JSON JavaScript Object Notation
Ahmed Muzammil
 
Cordova training : Day 4 - Advanced Javascript
Binu Paul
 
Xml processing in scala
Knoldus Inc.
 
Mongo db – document oriented database
Wojciech Sznapka
 
Xml processors
Saurav Mawandia
 
JSON(JavaScript Object Notation)
Raghu nath
 
NoSQL Endgame DevoxxUA Conference 2020
Thodoris Bais
 

Similar to Json – java script object notation (20)

PPT
Json
Manav Prasad
 
PPTX
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
PPTX
JSON & AJAX.pptx
dyumna2
 
PPT
json.ppt download for free for college project
AmitSharma397241
 
PPTX
JSON
Zara Tariq
 
PPTX
JSON - (English)
Senior Dev
 
PPTX
Unit-2.pptx
AnujSood25
 
PPTX
All about XML, JSON and related topics..
tinumanueltmt
 
PPT
Json - ideal for data interchange
Christoph Santschi
 
PDF
Json
soumya
 
PPTX
Json
primeteacher32
 
PPTX
Web Development Course - AJAX & JSON by RSOLUTIONS
RSolutions
 
PPTX
Intro to JSON
Mark Daniel Dacer
 
PPTX
J s o n
nasifalnahian
 
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
JSON & AJAX.pptx
dyumna2
 
json.ppt download for free for college project
AmitSharma397241
 
JSON - (English)
Senior Dev
 
Unit-2.pptx
AnujSood25
 
All about XML, JSON and related topics..
tinumanueltmt
 
Json - ideal for data interchange
Christoph Santschi
 
Json
soumya
 
Web Development Course - AJAX & JSON by RSOLUTIONS
RSolutions
 
Intro to JSON
Mark Daniel Dacer
 
J s o n
nasifalnahian
 
Ad

Recently uploaded (20)

PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PDF
Geographical diversity of India short notes by sandeep swamy
Sandeep Swamy
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
Quarter 1_PPT_PE & HEALTH 8_WEEK 3-4.pptx
ronajadolpnhs
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Dimensions of Societal Planning in Commonism
StefanMz
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
Geographical diversity of India short notes by sandeep swamy
Sandeep Swamy
 
Controller Request and Response in Odoo18
Celine George
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Quarter 1_PPT_PE & HEALTH 8_WEEK 3-4.pptx
ronajadolpnhs
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Ad

Json – java script object notation

  • 1. JSON – Java Script Object Notation Dilip Kumar Gupta
  • 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.  {  "fullname": "Swati Kumar",  "org": "Columbia",  }  <?xml version='1.0‘ encoding='UTF-8'?>  <element>  <fullname>Swati Kumar</fullname>  <org>Columbia</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