SlideShare a Scribd company logo
1 of 29
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)

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
Json
JsonJson
Json
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Javascript
JavascriptJavascript
Javascript
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
XSLT
XSLTXSLT
XSLT
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Json
JsonJson
Json
 
Node.js File system & Streams
Node.js File system & StreamsNode.js File system & Streams
Node.js File system & Streams
 
Javascript
JavascriptJavascript
Javascript
 
jQuery
jQueryjQuery
jQuery
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 

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)
 
Js ppt
Js pptJs ppt
Js ppt
 
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
 
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)
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

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/