SlideShare a Scribd company logo
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

Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
ShahDhruv21
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
Sehwan Noh
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Andres Baravalle
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
Kanda Runapongsa Saikaew
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
Bedis ElAchèche
 
JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)
BOSS Webtech
 
Ajax ppt
Ajax pptAjax ppt
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
Nidhi mishra
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
Alaref Abushaala
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Ravi Teja
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?
Simplilearn
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
WebStackAcademy
 

What's hot (20)

Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
Java script
Java scriptJava script
Java script
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
php
phpphp
php
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
Css Ppt
Css PptCss Ppt
Css Ppt
 

Viewers also liked

Dynamic HTML
Dynamic HTMLDynamic HTML
Dynamic HTML
Vinil Patel
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
Himanshu Kumar
 
Json
JsonJson
Java script ppt
Java script pptJava script ppt

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

json.pptx
json.pptxjson.pptx
json.pptx
Anum Zehra
 
Json
JsonJson
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?
codeandyou forums
 
java script json
java script jsonjava script json
java script json
chauhankapil
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)
Adnan Sohail
 
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)
 
Text processing by Rj
Text processing by RjText processing by Rj
JSON PRETTIFY.pdf
JSON PRETTIFY.pdfJSON PRETTIFY.pdf
JSON PRETTIFY.pdf
json beautifier
 
JSON - Quick Overview
JSON - Quick OverviewJSON - Quick Overview
JSON - Quick Overview
Signure Technologies
 
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
Sanjeev Kumar Jaiswal
 
JSON Injection
JSON InjectionJSON Injection
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
Hitesh Kumar
 
Intro to JSON
Intro to JSONIntro to JSON
Intro to JSON
Mark Daniel Dacer
 
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..
tinumanueltmt
 
JSON
JSONJSON
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
Boulder Java User's Group
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
Octavian Nadolu
 
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)
Senior Dev
 

Similar to 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
 
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

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

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/