SlideShare a Scribd company logo
1 of 29
Download to read offline
BUILT IN FAIRFIELD COUNTY:
FRONT END DEVELOPERS MEETUP
TUES. MAY 14, 2013
JSON: The Basics
About Jeff Fox (@jfox015)
 16 year web development professional
 (Almost) entirely self taught
 Has used various Ajax-esque data technologies since
2000, including XML, MS data islands and AMF for
Flash
 Develops JavaScript based web apps that rely on
JSON for data workflow
Overview
 What is JSON?
 Comparisons with XML
 Syntax
 Data Types
 Usage
 Live Examples
What is JSON?
JSON is…
 A lightweight text based data-interchange format
 Completely language independent
 Based on a subset of the JavaScript Programming
Language
 Easy to understand, manipulate and generate
JSON is NOT…
 Overly Complex
 A “document” format
 A markup language
 A programming language
Why use JSON?
 Straightforward syntax
 Easy to create and manipulate
 Can be natively parsed in JavaScript using eval()
 Supported by all major JavaScript frameworks
 Supported by most backend technologies
JSON vs. XML
Much Like XML
 Plain text formats
 “Self-describing“ (human readable)
 Hierarchical (Values can contain lists of objects or
values)
Not Like XML
 Lighter and faster than XML
 JSON uses typed objects. All XML values are type-
less strings and must be parsed at runtime.
 Less syntax, no semantics
 Properties are immediately accessible to JavaScript
code
Knocks against JSON
 Lack of namespaces
 No inherit validation (XML has DTD and
templates, but there is JSONlint)
 Not extensible
 It’s basically just not XML
Syntax
JSON Object Syntax
 Unordered sets of name/value pairs
 Begins with { (left brace)
 Ends with } (right brace)
 Each name is followed by : (colon)
 Name/value pairs are separated by , (comma)
JSON Example
var employeeData = {
"employee_id": 1234567,
"name": "Jeff Fox",
"hire_date": "1/1/2013",
"location": "Norwalk, CT",
"consultant": false
};
Arrays in JSON
 An ordered collection of values
 Begins with [ (left bracket)
 Ends with ] (right bracket)
 Name/value pairs are separated by , (comma)
JSON Array Example
var employeeData = {
"employee_id": 1236937,
"name": "Jeff Fox",
"hire_date": "1/1/2013",
"location": "Norwalk, CT",
"consultant": false,
"random_nums": [ 24,65,12,94 ]
};
Data Types
Data Types: Strings
 Sequence of 0 or more Unicode characters
 Wrapped in "double quotes“
 Backslash escapement
Data Types: Numbers
 Integer
 Real
 Scientific
 No octal or hex
 No NaN or Infinity – Use null instead.
Data Types: Booleans & Null
 Booleans: true or false
 Null: A value that specifies nothing or no value.
Data Types: Objects & Arrays
 Objects: Unordered key/value pairs wrapped in { }
 Arrays: Ordered key/value pairs wrapped in [ ]
JSON Usage
How & When to use JSON
 Transfer data to and from a server
 Perform asynchronous data calls without requiring
a page refresh
 Working with data stores
 Compile and save form or user data for local
storage
Where is JSON used today?
 Anywhere and everywhere!
And many,
many more!
Simple Example
Simple Demo
 Build a JSON data object in code
 Display raw output
 Display formatted output
 Manipulate via form input
Questions?
Resources
 Simple Demo on Github:
https://github.com/jfox015/BIFC-Simple-JSON-
Demo
 Another JSON Tutorial:
http://iviewsource.com/codingtutorials/getting-
started-with-javascript-object-notation-json-for-
absolute-beginners/
 JSON.org: http://www.json.org/
JSON: The Basics

More Related Content

What's hot (20)

jQuery
jQueryjQuery
jQuery
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Json
JsonJson
Json
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
Javascript
JavascriptJavascript
Javascript
 
Asp.net.
Asp.net.Asp.net.
Asp.net.
 
Javascript
JavascriptJavascript
Javascript
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Php array
Php arrayPhp array
Php array
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Express js
Express jsExpress js
Express js
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Ajax
AjaxAjax
Ajax
 

Viewers also liked (10)

JSON and XML
JSON and XMLJSON and XML
JSON and XML
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
 
Xhtml
XhtmlXhtml
Xhtml
 
Dhtml
DhtmlDhtml
Dhtml
 
XHTML
XHTMLXHTML
XHTML
 
Dhtml
DhtmlDhtml
Dhtml
 
Dynamic HTML
Dynamic HTMLDynamic HTML
Dynamic HTML
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Json
JsonJson
Json
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 

Similar to JSON: The Basics (20)

json.pptx
json.pptxjson.pptx
json.pptx
 
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
 
Json
JsonJson
Json
 
java script json
java script jsonjava script json
java script json
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)
 
JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)
 
Text processing by Rj
Text processing by RjText processing by Rj
Text processing by Rj
 
JSON PRETTIFY.pdf
JSON PRETTIFY.pdfJSON PRETTIFY.pdf
JSON PRETTIFY.pdf
 
JSON - Quick Overview
JSON - Quick OverviewJSON - Quick Overview
JSON - Quick Overview
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesBasics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
 
JSON Injection
JSON InjectionJSON Injection
JSON Injection
 
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
 
Json
JsonJson
Json
 
Intro to JSON
Intro to JSONIntro to JSON
Intro to JSON
 
Json
JsonJson
Json
 
All about XML, JSON and related topics..
All about XML, JSON and related topics..All about XML, JSON and related topics..
All about XML, JSON and related topics..
 
JSON
JSONJSON
JSON
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
 
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)
 

Recently uploaded

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 

Recently uploaded (20)

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 

JSON: The Basics

  • 1. BUILT IN FAIRFIELD COUNTY: FRONT END DEVELOPERS MEETUP TUES. MAY 14, 2013 JSON: The Basics
  • 2. About Jeff Fox (@jfox015)  16 year web development professional  (Almost) entirely self taught  Has used various Ajax-esque data technologies since 2000, including XML, MS data islands and AMF for Flash  Develops JavaScript based web apps that rely on JSON for data workflow
  • 3. Overview  What is JSON?  Comparisons with XML  Syntax  Data Types  Usage  Live Examples
  • 5. JSON is…  A lightweight text based data-interchange format  Completely language independent  Based on a subset of the JavaScript Programming Language  Easy to understand, manipulate and generate
  • 6. JSON is NOT…  Overly Complex  A “document” format  A markup language  A programming language
  • 7. Why use JSON?  Straightforward syntax  Easy to create and manipulate  Can be natively parsed in JavaScript using eval()  Supported by all major JavaScript frameworks  Supported by most backend technologies
  • 9. Much Like XML  Plain text formats  “Self-describing“ (human readable)  Hierarchical (Values can contain lists of objects or values)
  • 10. Not Like XML  Lighter and faster than XML  JSON uses typed objects. All XML values are type- less strings and must be parsed at runtime.  Less syntax, no semantics  Properties are immediately accessible to JavaScript code
  • 11. Knocks against JSON  Lack of namespaces  No inherit validation (XML has DTD and templates, but there is JSONlint)  Not extensible  It’s basically just not XML
  • 13. JSON Object Syntax  Unordered sets of name/value pairs  Begins with { (left brace)  Ends with } (right brace)  Each name is followed by : (colon)  Name/value pairs are separated by , (comma)
  • 14. JSON Example var employeeData = { "employee_id": 1234567, "name": "Jeff Fox", "hire_date": "1/1/2013", "location": "Norwalk, CT", "consultant": false };
  • 15. Arrays in JSON  An ordered collection of values  Begins with [ (left bracket)  Ends with ] (right bracket)  Name/value pairs are separated by , (comma)
  • 16. JSON Array Example var employeeData = { "employee_id": 1236937, "name": "Jeff Fox", "hire_date": "1/1/2013", "location": "Norwalk, CT", "consultant": false, "random_nums": [ 24,65,12,94 ] };
  • 18. Data Types: Strings  Sequence of 0 or more Unicode characters  Wrapped in "double quotes“  Backslash escapement
  • 19. Data Types: Numbers  Integer  Real  Scientific  No octal or hex  No NaN or Infinity – Use null instead.
  • 20. Data Types: Booleans & Null  Booleans: true or false  Null: A value that specifies nothing or no value.
  • 21. Data Types: Objects & Arrays  Objects: Unordered key/value pairs wrapped in { }  Arrays: Ordered key/value pairs wrapped in [ ]
  • 23. How & When to use JSON  Transfer data to and from a server  Perform asynchronous data calls without requiring a page refresh  Working with data stores  Compile and save form or user data for local storage
  • 24. Where is JSON used today?  Anywhere and everywhere! And many, many more!
  • 26. Simple Demo  Build a JSON data object in code  Display raw output  Display formatted output  Manipulate via form input
  • 28. Resources  Simple Demo on Github: https://github.com/jfox015/BIFC-Simple-JSON- Demo  Another JSON Tutorial: http://iviewsource.com/codingtutorials/getting- started-with-javascript-object-notation-json-for- absolute-beginners/  JSON.org: http://www.json.org/