0% found this document useful (0 votes)
2 views14 pages

Introduction To Json

This document introduces JSON, a lightweight, language-independent data-interchange format that is easy to understand and manipulate. It compares JSON with XML, highlighting its advantages such as straightforward syntax and native JavaScript support, while also noting its limitations like lack of namespaces. The document provides examples of JSON syntax and its usage in web development.

Uploaded by

donttrustmeeeee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views14 pages

Introduction To Json

This document introduces JSON, a lightweight, language-independent data-interchange format that is easy to understand and manipulate. It compares JSON with XML, highlighting its advantages such as straightforward syntax and native JavaScript support, while also noting its limitations like lack of namespaces. The document provides examples of JSON syntax and its usage in web development.

Uploaded by

donttrustmeeeee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction To

Json
About Jeff Fox
• 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
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

• 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
• Its basically just not XML
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 Exampe
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”:1234567,
“name”:”Jeff Fox”,
“hire_date”:”1/1/2013”,
“location”: “Norwalk, CT”,
“consultant”: false,
“random_nums”:[ 24,65,12,94 ]
};
Where is Json used today?

You might also like