SlideShare a Scribd company logo
3
Most read
8
Most read
9
Most read
JavaScript JSON
Prof. Neeraj Bhargava
Kapil Chauhan
Department of Computer Science
School of Engineering & Systems Sciences
MDS University, Ajmer
JavaScript JSON
 JSON is a format for storing and transporting data.
 JSON is often used when data is sent from a server to a
web page.
What is JSON?
 JSON stands for JavaScript Object Notation
 JSON is a lightweight data interchange format
 JSON is "self-describing" and easy to understand
Exchanging Data
 When exchanging data between a browser and a server,
the data can only be text.
 JSON is text, and we can convert any JavaScript object into
JSON, and send JSON to the server.
 We can also convert any JSON received from the server into
JavaScript objects.
 This way we can work with the data as JavaScript objects,
with no complicated parsing and translations.
JSON Syntax Rules
 Data is in name/value pairs
 Data is separated by commas
 Curly braces hold objects
 Square brackets hold arrays
JSON Data - A Name and a Value
 JSON data is written as name/value pairs, just like
JavaScript object properties.
 A name/value pair consists of a field name (in double
quotes), followed by a colon, followed by a value:
 "firstName":"John"
JSON Objects
 JSON objects are written inside curly braces.
 Just like in JavaScript, objects can contain multiple
name/value pairs:
 {"firstName":"John", "lastName":"Doe"}
JSON Arrays
 JSON arrays are written inside square brackets.
 Just like in JavaScript, an array can contain objects:
 "employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]
Converting a JSON Text to a
JavaScript Object
 A common use of JSON is to read data from a web server, and display
the data in a web page.
 For simplicity, this can be demonstrated using a string as input.
 First, create a JavaScript string containing JSON syntax:
var text = '{ "employees" : [' +
'{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" } ]}';
 Then, use the JavaScript built-in function JSON.parse() to convert the
string into a JavaScript object:
var obj = JSON.parse(text);
Assignment
 Explain JavaScript JSON with example and describe
following
 Syntax rule
 Exchanging data
 JSON Array

More Related Content

What's hot (20)

JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Hibernate ppt
Hibernate ppt
Aneega
 
Client & server side scripting
Client & server side scripting
baabtra.com - No. 1 supplier of quality freshers
 
Json
Json
Shyamala Prayaga
 
Sql Functions And Procedures
Sql Functions And Procedures
DataminingTools Inc
 
Java Script ppt
Java Script ppt
Priya Goyal
 
Ms sql-server
Ms sql-server
Md.Mojibul Hoque
 
PHP - Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
JSON
JSON
Zara Tariq
 
Intro to JSON
Intro to JSON
Mark Daniel Dacer
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
pcnmtutorials
 
Html tags
Html tags
sotero66
 
MongoDB Fundamentals
MongoDB Fundamentals
MongoDB
 
Hibernate Presentation
Hibernate Presentation
guest11106b
 
Jdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 
Javascript validating form
Javascript validating form
Jesus Obenita Jr.
 
jQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Yaml
Yaml
Christoph Santschi
 
predefined and user defined functions
predefined and user defined functions
Swapnil Yadav
 

Similar to java script json (20)

Introduction to JavaScript Object Notation(JSON)
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
Json
Json
baabtra.com - No. 1 supplier of quality freshers
 
Json
Json
krishnapriya Tadepalli
 
JSON - JavaScript Object Notation
JSON - JavaScript Object Notation
Sothearin Ren
 
Json
Json
soumya
 
JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)
Skillwise Group
 
Json
Json
Anand Kumar Rajana
 
JSON.pptx
JSON.pptx
MaheshHirulkar1
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
JSON Presentation.pptx JSON Presentation.pptx
JSON Presentation.pptx JSON Presentation.pptx
trwdcn
 
Json Tutorial
Json Tutorial
Napendra Singh
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guide
Rafael Montesinos Muñoz
 
JSON & AJAX.pptx
JSON & AJAX.pptx
dyumna2
 
JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)
Faysal Shaarani (MBA)
 
Hands on JSON
Hands on JSON
Octavian Nadolu
 
Intro to JSON
Intro to JSON
George McKinney
 
JSON(JavaScript Object Notation) Presentation transcript
JSON(JavaScript Object Notation) Presentation transcript
SRI NISHITH
 
Json
Json
primeteacher32
 
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
codeandyou forums
 
An introduction to json
An introduction to json
Naveenkumar5964
 
Ad

More from chauhankapil (20)

Gray level transformation
Gray level transformation
chauhankapil
 
Elements of visual perception
Elements of visual perception
chauhankapil
 
JSP Client Request
JSP Client Request
chauhankapil
 
Jsp server response
Jsp server response
chauhankapil
 
Markov decision process
Markov decision process
chauhankapil
 
RNN basics in deep learning
RNN basics in deep learning
chauhankapil
 
Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)
chauhankapil
 
Bayesian probabilistic interference
Bayesian probabilistic interference
chauhankapil
 
Jsp
Jsp
chauhankapil
 
Exception handling in java
Exception handling in java
chauhankapil
 
Knowledge acquistion
Knowledge acquistion
chauhankapil
 
Knowledge based system
Knowledge based system
chauhankapil
 
Introduction of predicate logics
Introduction of predicate logics
chauhankapil
 
Types of inheritance in java
Types of inheritance in java
chauhankapil
 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logics
chauhankapil
 
Inheritance in java
Inheritance in java
chauhankapil
 
Propositional logic
Propositional logic
chauhankapil
 
Constructors in java
Constructors in java
chauhankapil
 
Methods in java
Methods in java
chauhankapil
 
Circular linked list
Circular linked list
chauhankapil
 
Gray level transformation
Gray level transformation
chauhankapil
 
Elements of visual perception
Elements of visual perception
chauhankapil
 
JSP Client Request
JSP Client Request
chauhankapil
 
Jsp server response
Jsp server response
chauhankapil
 
Markov decision process
Markov decision process
chauhankapil
 
RNN basics in deep learning
RNN basics in deep learning
chauhankapil
 
Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)
chauhankapil
 
Bayesian probabilistic interference
Bayesian probabilistic interference
chauhankapil
 
Exception handling in java
Exception handling in java
chauhankapil
 
Knowledge acquistion
Knowledge acquistion
chauhankapil
 
Knowledge based system
Knowledge based system
chauhankapil
 
Introduction of predicate logics
Introduction of predicate logics
chauhankapil
 
Types of inheritance in java
Types of inheritance in java
chauhankapil
 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logics
chauhankapil
 
Inheritance in java
Inheritance in java
chauhankapil
 
Propositional logic
Propositional logic
chauhankapil
 
Constructors in java
Constructors in java
chauhankapil
 
Circular linked list
Circular linked list
chauhankapil
 
Ad

Recently uploaded (20)

chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Understanding Amplitude Modulation : A Guide
Understanding Amplitude Modulation : A Guide
CircuitDigest
 
OCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdf
Muanisa Waras
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Understanding Amplitude Modulation : A Guide
Understanding Amplitude Modulation : A Guide
CircuitDigest
 
OCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdf
Muanisa Waras
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 

java script json

  • 1. JavaScript JSON Prof. Neeraj Bhargava Kapil Chauhan Department of Computer Science School of Engineering & Systems Sciences MDS University, Ajmer
  • 2. JavaScript JSON  JSON is a format for storing and transporting data.  JSON is often used when data is sent from a server to a web page.
  • 3. What is JSON?  JSON stands for JavaScript Object Notation  JSON is a lightweight data interchange format  JSON is "self-describing" and easy to understand
  • 4. Exchanging Data  When exchanging data between a browser and a server, the data can only be text.  JSON is text, and we can convert any JavaScript object into JSON, and send JSON to the server.  We can also convert any JSON received from the server into JavaScript objects.  This way we can work with the data as JavaScript objects, with no complicated parsing and translations.
  • 5. JSON Syntax Rules  Data is in name/value pairs  Data is separated by commas  Curly braces hold objects  Square brackets hold arrays
  • 6. JSON Data - A Name and a Value  JSON data is written as name/value pairs, just like JavaScript object properties.  A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value:  "firstName":"John"
  • 7. JSON Objects  JSON objects are written inside curly braces.  Just like in JavaScript, objects can contain multiple name/value pairs:  {"firstName":"John", "lastName":"Doe"}
  • 8. JSON Arrays  JSON arrays are written inside square brackets.  Just like in JavaScript, an array can contain objects:  "employees":[ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":"Smith"}, {"firstName":"Peter", "lastName":"Jones"} ]
  • 9. Converting a JSON Text to a JavaScript Object  A common use of JSON is to read data from a web server, and display the data in a web page.  For simplicity, this can be demonstrated using a string as input.  First, create a JavaScript string containing JSON syntax: var text = '{ "employees" : [' + '{ "firstName":"John" , "lastName":"Doe" },' + '{ "firstName":"Anna" , "lastName":"Smith" },' + '{ "firstName":"Peter" , "lastName":"Jones" } ]}';  Then, use the JavaScript built-in function JSON.parse() to convert the string into a JavaScript object: var obj = JSON.parse(text);
  • 10. Assignment  Explain JavaScript JSON with example and describe following  Syntax rule  Exchanging data  JSON Array