SlideShare a Scribd company logo
2
Most read
8
Most read
9
Most read
Introduction to JSON
What is JSON
 JSON stands for JavaScript Object
Notation
 JSON is lightweight text-data
interchange format
 JSON is language independent *
 JSON is "self-describing" and easy to
understand
Example JSON
{
"id":1,
"name":”Anoop",
"billingAddress":[{"city":”Bangalore"}]
}
JSON is LIKE XML
 JSON is plain text
 JSON is "self-describing" (human
readable)
 JSON is hierarchical (values within
values)
 JSON can be parsed by JavaScript
JSON is UNLIKE XML
 No end tag
 Shorter
 Quicker to read and write
 Can be parsed using built-in
JavaScript parse()
 Uses arrays
 No reserved words
Data on a web page
 Using XML
 Fetch an XML document
 Use the XML DOM to loop through the document
 Extract values and store in variables
 Using JSON
 Fetch a JSON string
 parse() the JSON string to get javascript objects
JSON Syntax
 Data is in name/value pairs
 Data is separated by commas
 Curly braces hold objects
 Square brackets hold arrays
{
"id":1,
"name":”Anoop",
"billingAddress":[{"city":”Bangalore"}]
}
JSON object
 JSON objects are written inside curly
brackets,
 Objects can contain multiple name/values
pairs separated by comma:
{ "firstName":"John" , "lastName":"Doe" }
 Names in objects are supposed to be
unique. If they are not unique, the last
one is returned during access
JSON value
JSON Array
 JSON arrays are written inside square brackets.
 An array can contain multiple objects:
{
"employees": [
{ "firstName":”Sanjay" , "lastName":”Adiwal" },
{ "firstName":”Shubham" , "lastName":”Parikh" },
{ "firstName":”Anoop" , "lastName":”Pandey" }
]
}
JSON and Javascript
var employees = ‘[
{ "firstName":”Sanjay" , "lastName":”Adiwal" },
{ "firstName":”Shubham" , "lastName":”Parikh" },
{ "firstName":”Anoop" , "lastName":”Pandey" }
]’;
obj = JSON.parse(employees)
obj[0].lastName //Adiwal
obj[0].firstName // “Sanjay";
JSON and other languages
» APIs are available for all
contemporary web programming
languages
» All browsers today are JSON-aware
» For server-side, specific APIs are in
Java, .Net, PHP, etc.

More Related Content

PPTX
Spring & hibernate
PPTX
Intro to JSON
PPTX
Intro to Apache Spark
PPTX
Introduction to database & sql
PPTX
Java and OWL
PPTX
Java 8 lambda
PDF
Triggers and Stored Procedures
PPTX
Introduction to java
Spring & hibernate
Intro to JSON
Intro to Apache Spark
Introduction to database & sql
Java and OWL
Java 8 lambda
Triggers and Stored Procedures
Introduction to java

What's hot (20)

PPTX
Database connectivity in python
PPTX
Spark SQL Tutorial | Spark SQL Using Scala | Apache Spark Tutorial For Beginn...
PPT
standard template library(STL) in C++
PPTX
Java features
PPTX
Core java
PDF
Apache Spark Overview
PPTX
Regular Expression
PPTX
Encapsulation
PPTX
Introduction to Apache Spark
PDF
Object-oriented Programming-with C#
PPTX
This and Static Keyword
PPTX
Structured Query Language (SQL)
PDF
Introduction to Java Programming Language
PPTX
JSON: The Basics
PDF
Creating your own exception
PPTX
6. static keyword
PPTX
Introduction to Pig
PPT
Object Oriented Programming Concepts using Java
PPT
Java IO Package and Streams
PDF
Java 8 Lambda Built-in Functional Interfaces
Database connectivity in python
Spark SQL Tutorial | Spark SQL Using Scala | Apache Spark Tutorial For Beginn...
standard template library(STL) in C++
Java features
Core java
Apache Spark Overview
Regular Expression
Encapsulation
Introduction to Apache Spark
Object-oriented Programming-with C#
This and Static Keyword
Structured Query Language (SQL)
Introduction to Java Programming Language
JSON: The Basics
Creating your own exception
6. static keyword
Introduction to Pig
Object Oriented Programming Concepts using Java
Java IO Package and Streams
Java 8 Lambda Built-in Functional Interfaces
Ad

Similar to JSON.pptx (20)

PDF
Basics of JSON (JavaScript Object Notation) with examples
PPT
java script json
PPTX
Json training
PPTX
An introduction to json
PPTX
PPTX
Unit-2.pptx
PDF
Introduction to JSON
PPTX
json.pptx
PDF
CS8651 IP Unit 2 pdf regulation -2017 anna university
PPTX
Java script and json
PDF
Intro to JSON
PPTX
unit5_part2.pptx
PPTX
Introduction to JavaScript Object Notation(JSON)
PPT
JavaScript Object Notation (JSON)
PDF
JSON Learning
PDF
Json tutorial, a beguiner guide
PPTX
1 Json Intro and datatype PRESENTATION.pptx
PDF
JSON in JavaScript
Basics of JSON (JavaScript Object Notation) with examples
java script json
Json training
An introduction to json
Unit-2.pptx
Introduction to JSON
json.pptx
CS8651 IP Unit 2 pdf regulation -2017 anna university
Java script and json
Intro to JSON
unit5_part2.pptx
Introduction to JavaScript Object Notation(JSON)
JavaScript Object Notation (JSON)
JSON Learning
Json tutorial, a beguiner guide
1 Json Intro and datatype PRESENTATION.pptx
JSON in JavaScript
Ad

Recently uploaded (20)

PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Soil Improvement Techniques Note - Rabbi
PPTX
Artificial Intelligence
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
introduction to high performance computing
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PDF
737-MAX_SRG.pdf student reference guides
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
Design Guidelines and solutions for Plastics parts
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PPT
Occupational Health and Safety Management System
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Fundamentals of Mechanical Engineering.pptx
Soil Improvement Techniques Note - Rabbi
Artificial Intelligence
Module 8- Technological and Communication Skills.pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
introduction to high performance computing
distributed database system" (DDBS) is often used to refer to both the distri...
737-MAX_SRG.pdf student reference guides
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Categorization of Factors Affecting Classification Algorithms Selection
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
"Array and Linked List in Data Structures with Types, Operations, Implementat...
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Design Guidelines and solutions for Plastics parts
Safety Seminar civil to be ensured for safe working.
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Occupational Health and Safety Management System
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...

JSON.pptx

  • 2. What is JSON  JSON stands for JavaScript Object Notation  JSON is lightweight text-data interchange format  JSON is language independent *  JSON is "self-describing" and easy to understand
  • 4. JSON is LIKE XML  JSON is plain text  JSON is "self-describing" (human readable)  JSON is hierarchical (values within values)  JSON can be parsed by JavaScript
  • 5. JSON is UNLIKE XML  No end tag  Shorter  Quicker to read and write  Can be parsed using built-in JavaScript parse()  Uses arrays  No reserved words
  • 6. Data on a web page  Using XML  Fetch an XML document  Use the XML DOM to loop through the document  Extract values and store in variables  Using JSON  Fetch a JSON string  parse() the JSON string to get javascript objects
  • 7. JSON Syntax  Data is in name/value pairs  Data is separated by commas  Curly braces hold objects  Square brackets hold arrays { "id":1, "name":”Anoop", "billingAddress":[{"city":”Bangalore"}] }
  • 8. JSON object  JSON objects are written inside curly brackets,  Objects can contain multiple name/values pairs separated by comma: { "firstName":"John" , "lastName":"Doe" }  Names in objects are supposed to be unique. If they are not unique, the last one is returned during access
  • 10. JSON Array  JSON arrays are written inside square brackets.  An array can contain multiple objects: { "employees": [ { "firstName":”Sanjay" , "lastName":”Adiwal" }, { "firstName":”Shubham" , "lastName":”Parikh" }, { "firstName":”Anoop" , "lastName":”Pandey" } ] }
  • 11. JSON and Javascript var employees = ‘[ { "firstName":”Sanjay" , "lastName":”Adiwal" }, { "firstName":”Shubham" , "lastName":”Parikh" }, { "firstName":”Anoop" , "lastName":”Pandey" } ]’; obj = JSON.parse(employees) obj[0].lastName //Adiwal obj[0].firstName // “Sanjay";
  • 12. JSON and other languages » APIs are available for all contemporary web programming languages » All browsers today are JSON-aware » For server-side, specific APIs are in Java, .Net, PHP, etc.