SlideShare a Scribd company logo
3
Most read
4
Most read
7
Most read
JSON - Javascript
Object Notation
Prepared by: Ms Panda
Selling your idea
What is JSON?
- JSON is a Syntax for storing and exchanging data. It’s
a lightweight data-interchange format
- It means Javascript Object Notation.
- And it’s a text, written with Javascript Object
Notation.
- JSON is “self-describing” and easy to understand.
Also it’s language independent since text can be read
and used as a data format by any programming
language.
Selling your idea
Exchanging Data? How?
- When exchanging data between a browser and a
server, data can only be text.
- Since JSON is a text, so we can convert any
javascript Object into JSON and then send off to a
server.
Selling your idea
Exchanging Data? How?
- Not just converting Javascript Object into JSON, we
also can reverse the converting from JSON into
Javascript Object.
- By this way, we can work with Data as Javascript
Object, with no complicated Parsing and Translating.
Selling your idea
Sending data:
function login(username, pwd) {
var userObject = { "name" : username, "password" : pwd }
$.ajax({
url: "http://api-ams.me/v1/api/authentication",
type: "POST",
data: JSON.stringify(userObject),
success: function(response) {
console.log(“Successfully”);
},
error: function(error) {
console.log(“Error”);
}
})
}
Selling your idea
Receiving data:
function loadUser(id) {
$.ajax({
url: "http://api-ams.me/v1/api/users/"+id,
type: "GET",
success: function(response) {
console.log(response.data);
},
error: function(error) {
console.log(“Error”);
}
})
}
Selling your idea
Why use JSON?
- Since the JSON format is text only, it can easily be
sent to and from a server as seen in example above.
Besides, JSON is used as a data format by any
programming language.
- In Javascript, JSON.parse() is a built-in function to
convert a string - written in JSON format, into native
Javascript object.
Selling your idea
JSON Syntax:
- The JSON syntax is a subset of the Javascript syntax.
Rule:
➔ Data is in name/value pairs
➔ Data is separated by commas
➔ Curly braces hold objects
➔ Square brackets hold arrays
Selling your idea
JSON Data - A name and a value
- JSON data is written as name/value pairs. A
name/value pairs consists of a field name (in double
quotes), followed by a colon, followed by a value:
Example: "username" : "Jung"
Note: JSON names required double quotes. Javascript
names don’t.
Selling your idea
JSON - Evaluates to Javascript Objects
- The JSON format is almost identical to Javascript
objects.
JSON:
{ "username" : "Jung" }
JavaScript
{ username : "Jung" }
Selling your idea
JSON Value/Data Type
- In JSON, values must be one
of the following data types:
➔ String
➔ Number
➔ Object (JSON object)
➔ Array
➔ Boolean
- In JavaScript, values can also
be:
➔ Function
➔ Data
➔ Undefined
Selling your idea
JSON Data Types
JSON Strings: { "username":"Jung" }
JSON Numbers: { "age":28 }
JSON Objects: { "data":{
"username":"Jung",
"Age" : 28}
}
JSON Arrays: { "employees":[
"John", "Anna", "Peter" ] }
JSON Boolean: { "gender":true }
JSON Null: { "children":null }
Selling your idea
JSON Objects
Syntax: { "name" : "value" }
- JSON objects are surrounded by curly braces { }.
- JSON objects are written in key/value pairs.
- Keys must be strings, and values must be a valid
JSON data type (string, number, object, array,
boolean or null).
- Keys and values are separated by a colon.
- Each key/value pair is separated by a comma.
Selling your idea
JSON Objects - Accessing Object Values
- You can access the object values by using dot (.)
notation:
Example: var username = data.name
Selling your idea
JSON Objects - Looping an Object
- You can loop thru object properties by using for-in
loop:
Example:
user = { "name":"Jung", "age":28, "house":null };
for (x in user) {
document.getElementById("demo").innerHTML
+= x;
}
Selling your idea
JSON Files
➔ The file type for JSON files is “.json
➔ The MIME type of JSON text is “application/json”
➔ MIME - Multipurpose Internet Mail Extensions
➔ Link: https://en.wikipedia.org/wiki/MIME
Good luck!
Thank you!

More Related Content

What's hot (19)

Json Tutorial
Json Tutorial
Napendra Singh
 
Json
Json
baabtra.com - No. 1 supplier of quality freshers
 
java script json
java script json
chauhankapil
 
Json
Json
Steve Fort
 
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
codeandyou forums
 
JSON - Quick Overview
JSON - Quick Overview
Signure Technologies
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jackson
Stephane Rondal
 
Writing Domain Specific Languages with JSON Schema
Writing Domain Specific Languages with JSON Schema
Yos Riady
 
Schema Design
Schema Design
MongoDB
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
kriszyp
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in Oxygen
Octavian Nadolu
 
R-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using Twitter
Kevin Smith
 
J s o n
J s o n
nasifalnahian
 
What is JSON? | JSON vs XML | Edureka
What is JSON? | JSON vs XML | Edureka
Edureka!
 
Schema
Schema
Ergoclicks
 
Mongo DB
Mongo DB
SRM University Delhi-NCR sonepat
 
Networkin II Estructuras con MongoDB y Javascript
Networkin II Estructuras con MongoDB y Javascript
Víctor Mejía
 
Json
Json
baabtra.com - No. 1 supplier of quality freshers
 
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
codeandyou forums
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jackson
Stephane Rondal
 
Writing Domain Specific Languages with JSON Schema
Writing Domain Specific Languages with JSON Schema
Yos Riady
 
Schema Design
Schema Design
MongoDB
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
kriszyp
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in Oxygen
Octavian Nadolu
 
R-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using Twitter
Kevin Smith
 
What is JSON? | JSON vs XML | Edureka
What is JSON? | JSON vs XML | Edureka
Edureka!
 
Networkin II Estructuras con MongoDB y Javascript
Networkin II Estructuras con MongoDB y Javascript
Víctor Mejía
 

Similar to JSON - JavaScript Object Notation (20)

Unit-2.pptx
Unit-2.pptx
AnujSood25
 
JSON
JSON
Yoga Raja
 
Json training
Json training
Elavarasi Dc
 
Intro to JSON
Intro to JSON
George McKinney
 
JSON.pptx
JSON.pptx
MaheshHirulkar1
 
Introduction to JavaScript Object Notation(JSON)
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
Java script and json
Java script and json
Islam Abdelzaher
 
CS8651 IP Unit 2 pdf regulation -2017 anna university
CS8651 IP Unit 2 pdf regulation -2017 anna university
amrashbhanuabdul
 
Json
Json
Anderson Oliveira
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
Json – java script object notation
Json – java script object notation
Dilip Kumar Gupta
 
JSON Presentation.pptx JSON Presentation.pptx
JSON Presentation.pptx JSON Presentation.pptx
trwdcn
 
Introduction to JSON
Introduction to JSON
Kanda Runapongsa Saikaew
 
json.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 
Json – java script object notation
Json – java script object notation
Pankaj Srivastava
 
JSON.pptx
JSON.pptx
TilakaRt
 
Json
Json
Uma mohan
 
JSON & AJAX.pptx
JSON & AJAX.pptx
dyumna2
 
An introduction to json
An introduction to json
Naveenkumar5964
 
JSON Learning
JSON Learning
Khaled Md. Saifullah
 
Introduction to JavaScript Object Notation(JSON)
Introduction to JavaScript Object Notation(JSON)
gaikwaddavid2022
 
CS8651 IP Unit 2 pdf regulation -2017 anna university
CS8651 IP Unit 2 pdf regulation -2017 anna university
amrashbhanuabdul
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
Json – java script object notation
Json – java script object notation
Dilip Kumar Gupta
 
JSON Presentation.pptx JSON Presentation.pptx
JSON Presentation.pptx JSON Presentation.pptx
trwdcn
 
json.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 
Json – java script object notation
Json – java script object notation
Pankaj Srivastava
 
JSON & AJAX.pptx
JSON & AJAX.pptx
dyumna2
 
Ad

Recently uploaded (20)

Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Agile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Agile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Ad

JSON - JavaScript Object Notation

  • 1. JSON - Javascript Object Notation Prepared by: Ms Panda
  • 2. Selling your idea What is JSON? - JSON is a Syntax for storing and exchanging data. It’s a lightweight data-interchange format - It means Javascript Object Notation. - And it’s a text, written with Javascript Object Notation. - JSON is “self-describing” and easy to understand. Also it’s language independent since text can be read and used as a data format by any programming language.
  • 3. Selling your idea Exchanging Data? How? - When exchanging data between a browser and a server, data can only be text. - Since JSON is a text, so we can convert any javascript Object into JSON and then send off to a server.
  • 4. Selling your idea Exchanging Data? How? - Not just converting Javascript Object into JSON, we also can reverse the converting from JSON into Javascript Object. - By this way, we can work with Data as Javascript Object, with no complicated Parsing and Translating.
  • 5. Selling your idea Sending data: function login(username, pwd) { var userObject = { "name" : username, "password" : pwd } $.ajax({ url: "http://api-ams.me/v1/api/authentication", type: "POST", data: JSON.stringify(userObject), success: function(response) { console.log(“Successfully”); }, error: function(error) { console.log(“Error”); } }) }
  • 6. Selling your idea Receiving data: function loadUser(id) { $.ajax({ url: "http://api-ams.me/v1/api/users/"+id, type: "GET", success: function(response) { console.log(response.data); }, error: function(error) { console.log(“Error”); } }) }
  • 7. Selling your idea Why use JSON? - Since the JSON format is text only, it can easily be sent to and from a server as seen in example above. Besides, JSON is used as a data format by any programming language. - In Javascript, JSON.parse() is a built-in function to convert a string - written in JSON format, into native Javascript object.
  • 8. Selling your idea JSON Syntax: - The JSON syntax is a subset of the Javascript syntax. Rule: ➔ Data is in name/value pairs ➔ Data is separated by commas ➔ Curly braces hold objects ➔ Square brackets hold arrays
  • 9. Selling your idea JSON Data - A name and a value - JSON data is written as name/value pairs. A name/value pairs consists of a field name (in double quotes), followed by a colon, followed by a value: Example: "username" : "Jung" Note: JSON names required double quotes. Javascript names don’t.
  • 10. Selling your idea JSON - Evaluates to Javascript Objects - The JSON format is almost identical to Javascript objects. JSON: { "username" : "Jung" } JavaScript { username : "Jung" }
  • 11. Selling your idea JSON Value/Data Type - In JSON, values must be one of the following data types: ➔ String ➔ Number ➔ Object (JSON object) ➔ Array ➔ Boolean - In JavaScript, values can also be: ➔ Function ➔ Data ➔ Undefined
  • 12. Selling your idea JSON Data Types JSON Strings: { "username":"Jung" } JSON Numbers: { "age":28 } JSON Objects: { "data":{ "username":"Jung", "Age" : 28} } JSON Arrays: { "employees":[ "John", "Anna", "Peter" ] } JSON Boolean: { "gender":true } JSON Null: { "children":null }
  • 13. Selling your idea JSON Objects Syntax: { "name" : "value" } - JSON objects are surrounded by curly braces { }. - JSON objects are written in key/value pairs. - Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null). - Keys and values are separated by a colon. - Each key/value pair is separated by a comma.
  • 14. Selling your idea JSON Objects - Accessing Object Values - You can access the object values by using dot (.) notation: Example: var username = data.name
  • 15. Selling your idea JSON Objects - Looping an Object - You can loop thru object properties by using for-in loop: Example: user = { "name":"Jung", "age":28, "house":null }; for (x in user) { document.getElementById("demo").innerHTML += x; }
  • 16. Selling your idea JSON Files ➔ The file type for JSON files is “.json ➔ The MIME type of JSON text is “application/json” ➔ MIME - Multipurpose Internet Mail Extensions ➔ Link: https://en.wikipedia.org/wiki/MIME

Editor's Notes

  • #9: JSON syntax is derived from JavaScript object notation syntax:
  • #12: In JavaScript values can be all of the above, plus any other valid JavaScript expression, including: JSON Uses JavaScript Syntax Because JSON syntax is derived from JavaScript object notation, very little extra software is needed to work with JSON within JavaScript. With JavaScript you can create an object and assign data to it, like this: Example var person = { "name":"John", "age":31, "city":"New York" }; You can access a JavaScript object like this: Example // returns John person.name; Try it Yourself » It can also be accessed like this: Example // returns John person["name"]; Try it Yourself » Data can be modified like this: Example person.name = "Gilbert"; Try it Yourself » It can also be modified like this: Example person["name"] = "Gilbert"; Try it Yourself » You will learn how to convert JavaScript objects into JSON later in this tutorial.