SlideShare a Scribd company logo
JSON – Java Script Object
Notation
Introduction
 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.
Agenda
 Overview of the working of JSON
 Properties of JSON as a data format
 JSON with AJAX
 Advantages of using JSON with AJAX
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)

PPT
Web Services with Objective-C
Juio Barros
 
PPTX
Spring data jpa
Jeevesh Pandey
 
PPT
Connecting to a REST API in iOS
gillygize
 
PDF
Spring Data JPA
Cheng Ta Yeh
 
PDF
Few simple-type-tricks in scala
Ruslan Shevchenko
 
PPT
Simple Data Binding
Doncho Minkov
 
PPTX
Easy data-with-spring-data-jpa
Staples
 
PPTX
Using Webservice in iOS
Mahboob Nur
 
PDF
Tool Development 04 - XML
Nick Pruehs
 
PDF
Tool Development 05 - XML Schema, INI, JSON, YAML
Nick Pruehs
 
ODP
Spring Data in 10 minutes
Corneil du Plessis
 
PPTX
JDBC - JPA - Spring Data
Arturs Drozdovs
 
PDF
Client Server Communication on iOS
Make School
 
PDF
Xml & Java
Slim Ouertani
 
PPTX
Xml serialization
Raghu nath
 
ODP
Data repositories
Corneil du Plessis
 
PDF
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 
PPTX
Ajax xml json
Andrii Siusko
 
PDF
Difference between xml and json
Umar Ali
 
PPT
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
Web Services with Objective-C
Juio Barros
 
Spring data jpa
Jeevesh Pandey
 
Connecting to a REST API in iOS
gillygize
 
Spring Data JPA
Cheng Ta Yeh
 
Few simple-type-tricks in scala
Ruslan Shevchenko
 
Simple Data Binding
Doncho Minkov
 
Easy data-with-spring-data-jpa
Staples
 
Using Webservice in iOS
Mahboob Nur
 
Tool Development 04 - XML
Nick Pruehs
 
Tool Development 05 - XML Schema, INI, JSON, YAML
Nick Pruehs
 
Spring Data in 10 minutes
Corneil du Plessis
 
JDBC - JPA - Spring Data
Arturs Drozdovs
 
Client Server Communication on iOS
Make School
 
Xml & Java
Slim Ouertani
 
Xml serialization
Raghu nath
 
Data repositories
Corneil du Plessis
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 
Ajax xml json
Andrii Siusko
 
Difference between xml and json
Umar Ali
 
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 

Similar to Json (20)

PPT
Json – java script object notation
Dilip Kumar Gupta
 
PPT
Json – java script object notation
Pankaj Srivastava
 
PPTX
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
PPTX
LU 1.3. JSON & XML.pptx about how they work and introduction
niyigenagilbert6
 
PPT
json.ppt download for free for college project
AmitSharma397241
 
PPTX
JSON
Zara Tariq
 
PPTX
All about XML, JSON and related topics..
tinumanueltmt
 
PPTX
JSON & AJAX.pptx
dyumna2
 
PPTX
Json
primeteacher32
 
PPTX
JSON - (English)
Senior Dev
 
PPTX
Unit-2.pptx
AnujSood25
 
PPT
Json - ideal for data interchange
Christoph Santschi
 
PDF
Introduction to JSON
Kanda Runapongsa Saikaew
 
PDF
Json
soumya
 
PPTX
Json
Uma mohan
 
Json – java script object notation
Dilip Kumar Gupta
 
Json – java script object notation
Pankaj Srivastava
 
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
LU 1.3. JSON & XML.pptx about how they work and introduction
niyigenagilbert6
 
json.ppt download for free for college project
AmitSharma397241
 
All about XML, JSON and related topics..
tinumanueltmt
 
JSON & AJAX.pptx
dyumna2
 
JSON - (English)
Senior Dev
 
Unit-2.pptx
AnujSood25
 
Json - ideal for data interchange
Christoph Santschi
 
Introduction to JSON
Kanda Runapongsa Saikaew
 
Json
soumya
 
Json
Uma mohan
 
Ad

More from Manav Prasad (20)

PPTX
Experience with mulesoft
Manav Prasad
 
PPTX
Mulesoftconnectors
Manav Prasad
 
PPT
Mule and web services
Manav Prasad
 
PPTX
Mulesoft cloudhub
Manav Prasad
 
PPT
Perl tutorial
Manav Prasad
 
PPT
Hibernate presentation
Manav Prasad
 
PPT
Jpa
Manav Prasad
 
PPT
Spring introduction
Manav Prasad
 
PPT
The spring framework
Manav Prasad
 
PPT
Rest introduction
Manav Prasad
 
PPT
Exceptions in java
Manav Prasad
 
PPT
Junit
Manav Prasad
 
PPT
Xml parsers
Manav Prasad
 
PPT
Xpath
Manav Prasad
 
PPT
Xslt
Manav Prasad
 
PPT
Xhtml
Manav Prasad
 
PPT
Css
Manav Prasad
 
PPT
Introduction to html5
Manav Prasad
 
PPT
J query
Manav Prasad
 
PPTX
J query1
Manav Prasad
 
Experience with mulesoft
Manav Prasad
 
Mulesoftconnectors
Manav Prasad
 
Mule and web services
Manav Prasad
 
Mulesoft cloudhub
Manav Prasad
 
Perl tutorial
Manav Prasad
 
Hibernate presentation
Manav Prasad
 
Spring introduction
Manav Prasad
 
The spring framework
Manav Prasad
 
Rest introduction
Manav Prasad
 
Exceptions in java
Manav Prasad
 
Xml parsers
Manav Prasad
 
Introduction to html5
Manav Prasad
 
J query
Manav Prasad
 
J query1
Manav Prasad
 
Ad

Recently uploaded (20)

PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
The Future of Artificial Intelligence (AI)
Mukul
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 

Json

  • 1. JSON – Java Script Object Notation
  • 2. Introduction  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. Agenda  Overview of the working of JSON  Properties of JSON as a data format  JSON with AJAX  Advantages of using JSON with AJAX
  • 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