SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 

Was ist angesagt? (20)

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
Java script
Java scriptJava script
Java script
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP Strings
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
AngularJS
AngularJS AngularJS
AngularJS
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 

Andere mochten auch (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
 

Ähnlich wie JSON: The Basics

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)
Faysal Shaarani (MBA)
 
JSON PRETTIFY.pdf
JSON PRETTIFY.pdfJSON PRETTIFY.pdf
JSON PRETTIFY.pdf
json beautifier
 

Ähnlich wie JSON: The Basics (20)

json.pptx
json.pptxjson.pptx
json.pptx
 
Json
JsonJson
Json
 
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
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

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/