JSON: The Basics: Electronic
JSON: The Basics: Electronic
ELECTRONIC
COMMERCE
GARY P. SCHNEIDER
• What is JSON?
• Syntax
• Data Types
• Usage
• Live Examples
What is JSON?
JSON is…
• Overly Complex
• A “document” format
• A markup language
• A programming language
Why use JSON?
• Straightforward syntax
• Lack of namespaces
• Not extensible
var employeeData = {
"employee_id": 1234567,
"name": "Jeff Fox",
"hire_date": "1/1/2013",
"location": "Norwalk, CT",
"consultant": false
};
Arrays in JSON
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
• Backslash escapement
Data Types: Numbers
• Integer
• Real
• Scientific
• No octal or hex
And many,
many more!
Simple Example
Simple Demo
• JSON.org: http://www.json.org/