SlideShare ist ein Scribd-Unternehmen logo
1 von 69
JSON
The x in Ajax
Data Interchange
• The key idea in Ajax.
• An alternative to page
replacement.
• Applications delivered as pages.
• How should the data be
delivered?
History of Data Formats
• Ad Hoc
• Database Model
• Document Model
• Programming Language Model
JSON
• JavaScript Object Notation
• Minimal
• Textual
• Subset of JavaScript
JSON
• A Subset of ECMA-262 Third Edition.
• Language Independent.
• Text-based.
• Light-weight.
• Easy to parse.
JSON Is Not...
• JSON is not a document format.
• JSON is not a markup language.
• JSON is not a general
serialization format.
No cyclical/recurring structures.
No invisible structures.
No functions.
History
• 1999 ECMAScript Third Edition
• 2001 State Software, Inc.
• 2002 JSON.org
• 2005 Ajax
• 2006 RFC 4627
Languages
• Chinese
• English
• French
• German
• Italian
• Japanese
• Korean
Languages
• ActionScript
• C / C++
• C#
• Cold Fusion
• Delphi
• E
• Erlang
• Java
• Lisp
• Perl
• Objective-C
• Objective CAML
• PHP
• Python
• Rebol
• Ruby
• Scheme
• Squeak
Object Quasi-Literals
• JavaScript
• Python
• NewtonScript
Values
• Strings
• Numbers
• Booleans
• Objects
• Arrays
• null
Value
Strings
• Sequence of 0 or more Unicode
characters
• No separate character type
A character is represented as a
string with a length of 1
• Wrapped in "double quotes"
• Backslash escapement
String
Numbers
• Integer
• Real
• Scientific
• No octal or hex
• No NaN or Infinity
Use null instead
Number
Booleans
• true
• false
null
• A value that isn't anything
Object
• Objects are unordered containers
of key/value pairs
• Objects are wrapped in { }
• , separates key/value pairs
• : separates keys and values
• Keys are strings
• Values are JSON values
struct, record, hashtable, object
Object
Object
{"name":"Jack B. Nimble","at large":
true,"grade":"A","level":3, "format":
{"type":"rect","width":1920,
"height":1080,"interlace":false,
"framerate":24}}
Object
{
"name": "Jack B. Nimble",
"at large": true,
"grade": "A",
"format": {
"type": "rect",
"width": 1920,
"height": 1080,
"interlace": false,
"framerate": 24
}
}
Array
• Arrays are ordered sequences of
values
• Arrays are wrapped in []
• , separates values
• JSON does not talk about
indexing.
An implementation can start array
indexing at 0 or 1.
Array
Array
["Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday",
"Friday", "Saturday"]
[
[0, -1, 0],
[1, 0, 0],
[0, 0, 1]
]
Arrays vs Objects
• Use objects when the key names
are arbitrary strings.
• Use arrays when the key names
are sequential integers.
• Don't get confused by the term
Associative Array.
MIME Media Type
application/json
Character Encoding
• Strictly UNICODE.
• Default: UTF-8.
• UTF-16 and UTF-32 are allowed.
Versionless
• JSON has no version number.
• No revisions to the JSON
grammar are anticipated.
• JSON is very stable.
Rules
• A JSON decoder must accept all
well-formed JSON text.
• A JSON decoder may also accept
non-JSON text.
• A JSON encoder must only
produce well-formed JSON text.
• Be conservative in what you do,
be liberal in what you accept from
others.
Supersets
• YAML is a superset of JSON.
A YAML decoder is a JSON decoder.
• JavaScript is a superset of JSON.
A JavaScript compiler is a JSON
decoder.
• New programming languages
based on JSON.
JSON is the X in Ajax
JSON in Ajax
• HTML Delivery.
• JSON data is built into the page.
<html>...
<script>
var data = { ... JSONdata ... };
</script>...
</html>
JSON in Ajax
• XMLHttpRequest
Obtain responseText
Parse the responseText
responseData = eval(
'(' + responseText + ')');
responseData =
responseText.parseJSON();
JSON in Ajax
• Is it safe to use eval with
XMLHttpRequest?
• The JSON data comes from the
same server that vended the
page. eval of the data is no less
secure than the original html.
• If in doubt, use string.parseJSON
instead of eval.
JSON in Ajax
• Secret <iframe>
• Request data using form.submit to the
<iframe> target.
• The server sends the JSON text
embedded in a script in a document.
<html><head><script>
document.domain = 'penzance.com';
parent.deliver({ ... JSONtext ... });
</script></head></html>
• The function deliver is passed the
value.
JSON in Ajax
• Dynamic script tag hack.
• Create a script node. The src url
makes the request.
• The server sends the JSON text
embedded in a script.
deliver({ ... JSONtext ... });
• The function deliver is passed
the value.
• The dynamic script tag hack is
insecure.
JSONRequest
• A new facility.
• Two way data interchange
between any page and any server.
• Exempt from the Same Origin
Policy.
• Campaign to make a standard
feature of all browsers.
JSONRequest
function done(requestNr, value, exception) {
...
}
var request =
JSONRequest.post(url, data, done);
var request =
JSONRequest.get(url, done);
• No messing with headers.
• No cookies.
• No implied authentication.
JSONRequest
• Requests are transmitted in order.
• Requests can have timeouts.
• Requests can be cancelled.
• Connections are in addition to the
browser's ordinary two connections per
host.
• Support for asynchronous, full duplex
JSONRequest
• Tell your favorite browser maker
I want JSONRequest!
http://www.JSON.org/JSONRequest.html
ECMAScript Fourth Ed.
• New Methods:
Object.prototype.toJSONString
String.prototype.parseJSON
• Available now: JSON.org/json.js
supplant
var template = '<table border="{border}">' +
'<tr><th>Last</th><td>{last}</td></tr>' +
'<tr><th>First</th><td>{first}</td></tr>' +
'</table>';
var data = {
"first": "Carl",
"last": "Hollywood",
"border": 2
};
mydiv.innerHTML = template.supplant(data);
supplant
String.prototype.supplant = function (o) {
return this.replace(/{([^{}]*)}/g,
function (a, b) {
var r = o[b];
return typeof r === 'string' ?
r : a;
}
);
};
JSONT
var rules = {
self:
'<svg><{closed} stroke="{color}" points="{points}" /></svg>',
closed: function (x) {return x ? 'polygon' : 'polyline';},
'points[*][*]': '{$} '
};
var data = {
"color": "blue",
"closed": true,
"points": [[10,10], [20,10], [20,20], [10,20]]
};
jsonT(data, rules)
<svg><polygon stroke="blue"
points="10 10 20 10 20 20 10 20 " /></svg>
http://goessner.net/articles/jsont/
function jsonT(self, rules) {
var T = {
output: false,
init: function () {
for (var rule in rules) if (rule.substr(0,4) != "self") rules["self." + rule] = rules[rule];
return this;
},
apply: function(expr) {
var trf = function (s) {
return s.replace(/{([A-Za-z0-9_$.[]'@()]+)}/g, function ($0, $1){
return T.processArg($1, expr);
})
}, x = expr.replace(/[[0-9]+]/g, "[*]"), res;
if (x in rules) {
if (typeof(rules[x]) == "string") res = trf(rules[x]);
else if (typeof(rules[x]) == "function") res = trf(rules[x](eval(expr)).toString());
} else res = T.eval(expr);
return res;
},
processArg: function (arg, parentExpr) {
var expand = function (a, e) {
return (e = a.replace(/^$/,e)).substr(0, 4) != "self" ? ("self." + e) : e;
}, res = "";
T.output = true;
if (arg.charAt(0) == "@") res = eval(arg.replace(/@([A-za-z0-9_]+)(([A-Za-z0-9_$.[]']+))/, function($0, $1, $2){
return "rules['self." + $1 + "'](" + expand($2,parentExpr) + ")";
}));
else if (arg != "$") res = T.apply(expand(arg, parentExpr));
else res = T.eval(parentExpr);
T.output = false;
return res;
},
eval: function (expr) {
var v = eval(expr), res = "";
if (typeof(v) != "undefined") {
if (v instanceof Array) {
for (var i = 0; i < v.length; i++) if (typeof(v[i]) != "undefined") res += T.apply(expr + "[" + i + "]");
} else if (typeof(v) == "object") {
for (var m in v) if (typeof(v[m]) != "undefined") res += T.apply(expr+"."+m);
} else if (T.output) res += v;
}
return res;
}
};
return T.init().apply("self");
}
Some features that make it
well-suited for data transfer
• It's simultaneously human- and machine-
readable format;
• It has support for Unicode, allowing almost
any information in any human language to be
communicated;
• The self-documenting format that describes
structure and field names as well as specific
values;
• The strict syntax and parsing requirements
that allow the necessary parsing algorithms
to remain simple, efficient, and consistent;
• The ability to represent the most general
computer science data structures: records,
lists and trees.
JSON Looks Like Data
• JSON's simple values are the same as used in
programming languages.
• No restructuring is required: JSON's
structures look like conventional
programming language structures.
• JSON's object is record, struct, object,
dictionary, hash, associate array...
• JSON's array is array, vector, sequence, list...
Arguments against JSON
• JSON Doesn't Have Namespaces.
• JSON Has No Validator.
• JSON Is Not Extensible.
• JSON Is Not XML.
JSON Doesn't Have
Namespaces
• Every object is a namespace. Its
set of keys is independent of all
other objects, even exclusive of
nesting.
• JSON uses context to avoid
ambiguity, just as programming
languages do.
Namespace
• http://www.w3c.org/TR/REC-xml-names/
• In this example, there are three occurrences of the
name title within the markup, and the name alone
clearly provides insufficient information to allow
correct processing by a software module.
<section>
<title>Book-Signing Event</title>
<signing>
<author title="Mr" name="Vikram Seth" />
<book title="A Suitable Boy" price="$22.95" />
</signing>
<signing>
<author title="Dr" name="Oliver Sacks" />
<book title="The Island of the Color-Blind"
price="$12.95" />
</signing>
Namespace
{"section":
"title": "Book-Signing Event",
"signing": [
{
"author": { "title": "Mr", "name": "Vikram Seth" },
"book": { "title": "A Suitable Boy",
"price": "$22.95" }
}, {
"author": { "title": "Dr", "name": "Oliver Sacks" },
"book": { "title": "The Island of the Color-Blind",
"price": "$12.95" }
}
]
}}
• section.title
• section.signing[0].author.title
• section.signing[1].book.title
JSON Has No Validator
• Being well-formed and valid is not
the same as being correct and
relevant.
• Ultimately, every application is
responsible for validating its
inputs. This cannot be delegated.
• A YAML validator can be used.
JSON is Not Extensible
• It does not need to be.
• It can represent any non-recurrent
data structure as is.
• JSON is flexible. New fields can
be added to existing structures
without obsoleting existing
programs.
JSON Is Not XML
• objects
• arrays
• strings
• numbers
• booleans
• null
• element
• attribute
• attribute string
• content
• <![CDATA[ ]]>
• entities
• declarations
• schema
• stylesheets
• comments
• version
• namespace
Data Interchange
• JSON is a simple, common
representation of data.
• Communication between servers
and browser clients.
• Communication between peers.
• Language independent data
Why the Name?
• XML is not a good data
interchange format, but it is a
document standard.
• Having a standard to refer to
eliminates a lot of squabbling.
Going Meta
• By adding one level of meta-
encoding, JSON can be made to
do the things that JSON can't do.
• Recurrent and recursive
structures.
• Values beyond the ordinary base
values.
Going Meta
• Simply replace the troublesome
structures and values with an
object which describes them.
{
"$META$": meta-type,
"value": meta-value
}
Going Meta
• Possible meta-types:
"label" Label a structure
for reuse.
"ref" Reuse a structure.
"class" Associate a class
with a structure.
"type" Associate a special
type, such as Date,
with a structure.
Browser Innovation
• During the Browser War,
innovation was driven by the
browser makers.
• In the Ajax Age, innovation is
being driven by application
developers.
• The browser makers are falling
behind.
The Mashup Security
Problem
• Mashups are an interesting new
way to build applications.
• Mashups do not work when any of
the modules or widgets contains
information that is private or
represents a connection which is
private.
The Mashup Security
Problem
• JavaScript and the DOM provide
completely inadequate levels of
security.
• Mashups require a security model
that provides cooperation under
mutual suspicion.
The Mashup Security
Solution
<module id="NAME" href="URL"
style="STYLE" />
• A module is like a restricted iframe.
The parent script is not allowed access
to the module's window object. The
module's script is not allowed access
to the parent's window object.
The Mashup Security
Solution
<module id="NAME" href="URL" style="STYLE" />
• The module node presents a send
method which allows for sending a
JSON string to the module script.
• The module node can accept a receive
method which allows for receiving a
JSON string from the module script.
The Mashup Security
Solution
<module id="NAME" href="URL" style="STYLE" />
• Inside the module, there is a global
send function which allows for sending
a JSON string to the outer document's
script.
• Inside the module, you can define a
receive method which allows for
receiving a JSON string from the outer
document's script.
The Mashup Security
Solution
<module id="NAME" href="URL" style="STYLE" />
The Mashup Security
Solution
<module id="NAME" href="URL" style="STYLE" />
• Communiciation is permitted only
through cooperating send and
receive functions.
• The module is exempt from the
Same Origin Policy.
The Mashup Security
Solution
<module id="NAME" href="URL" style="STYLE" />
• Ask your favorite browser maker
for the <module> tag.

Weitere ähnliche Inhalte

Was ist angesagt?

JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)Skillwise Group
 
Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Ramamohan Chokkam
 
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Kai Chan
 
Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Kai Chan
 
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 examplesSanjeev Kumar Jaiswal
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...GeeksLab Odessa
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scalaRuslan Shevchenko
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xsltKumar
 
Get the most out of Solr search with PHP
Get the most out of Solr search with PHPGet the most out of Solr search with PHP
Get the most out of Solr search with PHPPaul Borgermans
 
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJS
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJSThe Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJS
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJSmfyleman
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013Roy Russo
 

Was ist angesagt? (20)

J s-o-n-120219575328402-3
J s-o-n-120219575328402-3J s-o-n-120219575328402-3
J s-o-n-120219575328402-3
 
JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)
 
Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02
 
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
 
Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
Json
JsonJson
Json
 
Xml parsing
Xml parsingXml parsing
Xml parsing
 
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
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guideJson tutorial, a beguiner guide
Json tutorial, a beguiner guide
 
Intermediate JavaScript
Intermediate JavaScriptIntermediate JavaScript
Intermediate JavaScript
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Get the most out of Solr search with PHP
Get the most out of Solr search with PHPGet the most out of Solr search with PHP
Get the most out of Solr search with PHP
 
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJS
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJSThe Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJS
The Road To Damascus - A Conversion Experience: LotusScript and @Formula to SSJS
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013
 
Sax parser
Sax parserSax parser
Sax parser
 
DOM and SAX
DOM and SAXDOM and SAX
DOM and SAX
 
Dom parser
Dom parserDom parser
Dom parser
 

Andere mochten auch

C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...
C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...
C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...DataStax Academy
 
Elastic Web Mining
Elastic Web MiningElastic Web Mining
Elastic Web MiningKen Krugler
 
Game Programming 03 - Git Flow
Game Programming 03 - Git FlowGame Programming 03 - Git Flow
Game Programming 03 - Git FlowNick Pruehs
 
Game Programming 12 - Shaders
Game Programming 12 - ShadersGame Programming 12 - Shaders
Game Programming 12 - ShadersNick Pruehs
 
Eight Rules for Making Your First Great Game
Eight Rules for Making Your First Great GameEight Rules for Making Your First Great Game
Eight Rules for Making Your First Great GameNick Pruehs
 

Andere mochten auch (6)

Was uns wirklich nährt
Was uns wirklich nährtWas uns wirklich nährt
Was uns wirklich nährt
 
C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...
C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...
C* Summit 2013: Suicide Risk Prediction Using Social Media and Cassandra by K...
 
Elastic Web Mining
Elastic Web MiningElastic Web Mining
Elastic Web Mining
 
Game Programming 03 - Git Flow
Game Programming 03 - Git FlowGame Programming 03 - Git Flow
Game Programming 03 - Git Flow
 
Game Programming 12 - Shaders
Game Programming 12 - ShadersGame Programming 12 - Shaders
Game Programming 12 - Shaders
 
Eight Rules for Making Your First Great Game
Eight Rules for Making Your First Great GameEight Rules for Making Your First Great Game
Eight Rules for Making Your First Great Game
 

Ähnlich wie Json - ideal for data interchange

json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college projectAmitSharma397241
 
Speed Up Your APEX Apps with JSON and Handlebars
Speed Up Your APEX Apps with JSON and HandlebarsSpeed Up Your APEX Apps with JSON and Handlebars
Speed Up Your APEX Apps with JSON and HandlebarsMarko Gorički
 
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)Senior Dev
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)Eugene Yokota
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Ontico
 
Web technologies-course 10.pptx
Web technologies-course 10.pptxWeb technologies-course 10.pptx
Web technologies-course 10.pptxStefan Oprea
 
The NoSQL Way in Postgres
The NoSQL Way in PostgresThe NoSQL Way in Postgres
The NoSQL Way in PostgresEDB
 
Data exchange over internet (XML vs JSON)
Data exchange over internet (XML vs JSON)Data exchange over internet (XML vs JSON)
Data exchange over internet (XML vs JSON)Wajahat Shahid
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.Jurriaan Persyn
 

Ähnlich wie Json - ideal for data interchange (20)

json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Unit-2.pptx
Unit-2.pptxUnit-2.pptx
Unit-2.pptx
 
Speed Up Your APEX Apps with JSON and Handlebars
Speed Up Your APEX Apps with JSON and HandlebarsSpeed Up Your APEX Apps with JSON and Handlebars
Speed Up Your APEX Apps with JSON and Handlebars
 
Json processing
Json processingJson processing
Json processing
 
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)
 
JSON
JSONJSON
JSON
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
 
Web technologies-course 10.pptx
Web technologies-course 10.pptxWeb technologies-course 10.pptx
Web technologies-course 10.pptx
 
No sql way_in_pg
No sql way_in_pgNo sql way_in_pg
No sql way_in_pg
 
JSON
JSONJSON
JSON
 
Mathias test
Mathias testMathias test
Mathias test
 
AJAX
AJAXAJAX
AJAX
 
The NoSQL Way in Postgres
The NoSQL Way in PostgresThe NoSQL Way in Postgres
The NoSQL Way in Postgres
 
ElasticSearch
ElasticSearchElasticSearch
ElasticSearch
 
Data exchange over internet (XML vs JSON)
Data exchange over internet (XML vs JSON)Data exchange over internet (XML vs JSON)
Data exchange over internet (XML vs JSON)
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
Json
JsonJson
Json
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
ERRest and Dojo
ERRest and DojoERRest and Dojo
ERRest and Dojo
 

Mehr von Christoph Santschi (15)

Yaml
YamlYaml
Yaml
 
Self Assembly
Self AssemblySelf Assembly
Self Assembly
 
Wasser und die Biochemie des Menschen
Wasser und die Biochemie des MenschenWasser und die Biochemie des Menschen
Wasser und die Biochemie des Menschen
 
F sharp - an overview
F sharp - an overviewF sharp - an overview
F sharp - an overview
 
Prinzipien funktionaler programmierung
Prinzipien funktionaler programmierungPrinzipien funktionaler programmierung
Prinzipien funktionaler programmierung
 
Analyse-Methodik
Analyse-MethodikAnalyse-Methodik
Analyse-Methodik
 
Ernaehrung und Gesundheit
Ernaehrung und GesundheitErnaehrung und Gesundheit
Ernaehrung und Gesundheit
 
Schlafstoerung
SchlafstoerungSchlafstoerung
Schlafstoerung
 
Enzyme
EnzymeEnzyme
Enzyme
 
Natürliche Schmerzmittel
Natürliche SchmerzmittelNatürliche Schmerzmittel
Natürliche Schmerzmittel
 
Die w fragen
Die w fragenDie w fragen
Die w fragen
 
Vitamin D - das Sonnenvitamin
Vitamin D - das SonnenvitaminVitamin D - das Sonnenvitamin
Vitamin D - das Sonnenvitamin
 
Standortbestimmung Ernährung - Wo sind wir?
Standortbestimmung Ernährung - Wo sind wir?Standortbestimmung Ernährung - Wo sind wir?
Standortbestimmung Ernährung - Wo sind wir?
 
Ad(h)s und Ernaehrung
Ad(h)s und ErnaehrungAd(h)s und Ernaehrung
Ad(h)s und Ernaehrung
 
Projektmanagement
ProjektmanagementProjektmanagement
Projektmanagement
 

Kürzlich hochgeladen

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 

Kürzlich hochgeladen (20)

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 

Json - ideal for data interchange

  • 2. Data Interchange • The key idea in Ajax. • An alternative to page replacement. • Applications delivered as pages. • How should the data be delivered?
  • 3. History of Data Formats • Ad Hoc • Database Model • Document Model • Programming Language Model
  • 4. JSON • JavaScript Object Notation • Minimal • Textual • Subset of JavaScript
  • 5. JSON • A Subset of ECMA-262 Third Edition. • Language Independent. • Text-based. • Light-weight. • Easy to parse.
  • 6. JSON Is Not... • JSON is not a document format. • JSON is not a markup language. • JSON is not a general serialization format. No cyclical/recurring structures. No invisible structures. No functions.
  • 7. History • 1999 ECMAScript Third Edition • 2001 State Software, Inc. • 2002 JSON.org • 2005 Ajax • 2006 RFC 4627
  • 8. Languages • Chinese • English • French • German • Italian • Japanese • Korean
  • 9. Languages • ActionScript • C / C++ • C# • Cold Fusion • Delphi • E • Erlang • Java • Lisp • Perl • Objective-C • Objective CAML • PHP • Python • Rebol • Ruby • Scheme • Squeak
  • 10. Object Quasi-Literals • JavaScript • Python • NewtonScript
  • 11. Values • Strings • Numbers • Booleans • Objects • Arrays • null
  • 12. Value
  • 13. Strings • Sequence of 0 or more Unicode characters • No separate character type A character is represented as a string with a length of 1 • Wrapped in "double quotes" • Backslash escapement
  • 15. Numbers • Integer • Real • Scientific • No octal or hex • No NaN or Infinity Use null instead
  • 18. null • A value that isn't anything
  • 19. Object • Objects are unordered containers of key/value pairs • Objects are wrapped in { } • , separates key/value pairs • : separates keys and values • Keys are strings • Values are JSON values struct, record, hashtable, object
  • 21. Object {"name":"Jack B. Nimble","at large": true,"grade":"A","level":3, "format": {"type":"rect","width":1920, "height":1080,"interlace":false, "framerate":24}}
  • 22. Object { "name": "Jack B. Nimble", "at large": true, "grade": "A", "format": { "type": "rect", "width": 1920, "height": 1080, "interlace": false, "framerate": 24 } }
  • 23. Array • Arrays are ordered sequences of values • Arrays are wrapped in [] • , separates values • JSON does not talk about indexing. An implementation can start array indexing at 0 or 1.
  • 24. Array
  • 25. Array ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] [ [0, -1, 0], [1, 0, 0], [0, 0, 1] ]
  • 26. Arrays vs Objects • Use objects when the key names are arbitrary strings. • Use arrays when the key names are sequential integers. • Don't get confused by the term Associative Array.
  • 28. Character Encoding • Strictly UNICODE. • Default: UTF-8. • UTF-16 and UTF-32 are allowed.
  • 29. Versionless • JSON has no version number. • No revisions to the JSON grammar are anticipated. • JSON is very stable.
  • 30. Rules • A JSON decoder must accept all well-formed JSON text. • A JSON decoder may also accept non-JSON text. • A JSON encoder must only produce well-formed JSON text. • Be conservative in what you do, be liberal in what you accept from others.
  • 31. Supersets • YAML is a superset of JSON. A YAML decoder is a JSON decoder. • JavaScript is a superset of JSON. A JavaScript compiler is a JSON decoder. • New programming languages based on JSON.
  • 32. JSON is the X in Ajax
  • 33. JSON in Ajax • HTML Delivery. • JSON data is built into the page. <html>... <script> var data = { ... JSONdata ... }; </script>... </html>
  • 34. JSON in Ajax • XMLHttpRequest Obtain responseText Parse the responseText responseData = eval( '(' + responseText + ')'); responseData = responseText.parseJSON();
  • 35. JSON in Ajax • Is it safe to use eval with XMLHttpRequest? • The JSON data comes from the same server that vended the page. eval of the data is no less secure than the original html. • If in doubt, use string.parseJSON instead of eval.
  • 36. JSON in Ajax • Secret <iframe> • Request data using form.submit to the <iframe> target. • The server sends the JSON text embedded in a script in a document. <html><head><script> document.domain = 'penzance.com'; parent.deliver({ ... JSONtext ... }); </script></head></html> • The function deliver is passed the value.
  • 37. JSON in Ajax • Dynamic script tag hack. • Create a script node. The src url makes the request. • The server sends the JSON text embedded in a script. deliver({ ... JSONtext ... }); • The function deliver is passed the value. • The dynamic script tag hack is insecure.
  • 38. JSONRequest • A new facility. • Two way data interchange between any page and any server. • Exempt from the Same Origin Policy. • Campaign to make a standard feature of all browsers.
  • 39. JSONRequest function done(requestNr, value, exception) { ... } var request = JSONRequest.post(url, data, done); var request = JSONRequest.get(url, done); • No messing with headers. • No cookies. • No implied authentication.
  • 40. JSONRequest • Requests are transmitted in order. • Requests can have timeouts. • Requests can be cancelled. • Connections are in addition to the browser's ordinary two connections per host. • Support for asynchronous, full duplex
  • 41. JSONRequest • Tell your favorite browser maker I want JSONRequest! http://www.JSON.org/JSONRequest.html
  • 42. ECMAScript Fourth Ed. • New Methods: Object.prototype.toJSONString String.prototype.parseJSON • Available now: JSON.org/json.js
  • 43. supplant var template = '<table border="{border}">' + '<tr><th>Last</th><td>{last}</td></tr>' + '<tr><th>First</th><td>{first}</td></tr>' + '</table>'; var data = { "first": "Carl", "last": "Hollywood", "border": 2 }; mydiv.innerHTML = template.supplant(data);
  • 44. supplant String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' ? r : a; } ); };
  • 45. JSONT var rules = { self: '<svg><{closed} stroke="{color}" points="{points}" /></svg>', closed: function (x) {return x ? 'polygon' : 'polyline';}, 'points[*][*]': '{$} ' }; var data = { "color": "blue", "closed": true, "points": [[10,10], [20,10], [20,20], [10,20]] }; jsonT(data, rules) <svg><polygon stroke="blue" points="10 10 20 10 20 20 10 20 " /></svg>
  • 46. http://goessner.net/articles/jsont/ function jsonT(self, rules) { var T = { output: false, init: function () { for (var rule in rules) if (rule.substr(0,4) != "self") rules["self." + rule] = rules[rule]; return this; }, apply: function(expr) { var trf = function (s) { return s.replace(/{([A-Za-z0-9_$.[]'@()]+)}/g, function ($0, $1){ return T.processArg($1, expr); }) }, x = expr.replace(/[[0-9]+]/g, "[*]"), res; if (x in rules) { if (typeof(rules[x]) == "string") res = trf(rules[x]); else if (typeof(rules[x]) == "function") res = trf(rules[x](eval(expr)).toString()); } else res = T.eval(expr); return res; }, processArg: function (arg, parentExpr) { var expand = function (a, e) { return (e = a.replace(/^$/,e)).substr(0, 4) != "self" ? ("self." + e) : e; }, res = ""; T.output = true; if (arg.charAt(0) == "@") res = eval(arg.replace(/@([A-za-z0-9_]+)(([A-Za-z0-9_$.[]']+))/, function($0, $1, $2){ return "rules['self." + $1 + "'](" + expand($2,parentExpr) + ")"; })); else if (arg != "$") res = T.apply(expand(arg, parentExpr)); else res = T.eval(parentExpr); T.output = false; return res; }, eval: function (expr) { var v = eval(expr), res = ""; if (typeof(v) != "undefined") { if (v instanceof Array) { for (var i = 0; i < v.length; i++) if (typeof(v[i]) != "undefined") res += T.apply(expr + "[" + i + "]"); } else if (typeof(v) == "object") { for (var m in v) if (typeof(v[m]) != "undefined") res += T.apply(expr+"."+m); } else if (T.output) res += v; } return res; } }; return T.init().apply("self"); }
  • 47. Some features that make it well-suited for data transfer • It's simultaneously human- and machine- readable format; • It has support for Unicode, allowing almost any information in any human language to be communicated; • The self-documenting format that describes structure and field names as well as specific values; • The strict syntax and parsing requirements that allow the necessary parsing algorithms to remain simple, efficient, and consistent; • The ability to represent the most general computer science data structures: records, lists and trees.
  • 48. JSON Looks Like Data • JSON's simple values are the same as used in programming languages. • No restructuring is required: JSON's structures look like conventional programming language structures. • JSON's object is record, struct, object, dictionary, hash, associate array... • JSON's array is array, vector, sequence, list...
  • 49. Arguments against JSON • JSON Doesn't Have Namespaces. • JSON Has No Validator. • JSON Is Not Extensible. • JSON Is Not XML.
  • 50. JSON Doesn't Have Namespaces • Every object is a namespace. Its set of keys is independent of all other objects, even exclusive of nesting. • JSON uses context to avoid ambiguity, just as programming languages do.
  • 51. Namespace • http://www.w3c.org/TR/REC-xml-names/ • In this example, there are three occurrences of the name title within the markup, and the name alone clearly provides insufficient information to allow correct processing by a software module. <section> <title>Book-Signing Event</title> <signing> <author title="Mr" name="Vikram Seth" /> <book title="A Suitable Boy" price="$22.95" /> </signing> <signing> <author title="Dr" name="Oliver Sacks" /> <book title="The Island of the Color-Blind" price="$12.95" /> </signing>
  • 52. Namespace {"section": "title": "Book-Signing Event", "signing": [ { "author": { "title": "Mr", "name": "Vikram Seth" }, "book": { "title": "A Suitable Boy", "price": "$22.95" } }, { "author": { "title": "Dr", "name": "Oliver Sacks" }, "book": { "title": "The Island of the Color-Blind", "price": "$12.95" } } ] }} • section.title • section.signing[0].author.title • section.signing[1].book.title
  • 53. JSON Has No Validator • Being well-formed and valid is not the same as being correct and relevant. • Ultimately, every application is responsible for validating its inputs. This cannot be delegated. • A YAML validator can be used.
  • 54. JSON is Not Extensible • It does not need to be. • It can represent any non-recurrent data structure as is. • JSON is flexible. New fields can be added to existing structures without obsoleting existing programs.
  • 55. JSON Is Not XML • objects • arrays • strings • numbers • booleans • null • element • attribute • attribute string • content • <![CDATA[ ]]> • entities • declarations • schema • stylesheets • comments • version • namespace
  • 56. Data Interchange • JSON is a simple, common representation of data. • Communication between servers and browser clients. • Communication between peers. • Language independent data
  • 57. Why the Name? • XML is not a good data interchange format, but it is a document standard. • Having a standard to refer to eliminates a lot of squabbling.
  • 58. Going Meta • By adding one level of meta- encoding, JSON can be made to do the things that JSON can't do. • Recurrent and recursive structures. • Values beyond the ordinary base values.
  • 59. Going Meta • Simply replace the troublesome structures and values with an object which describes them. { "$META$": meta-type, "value": meta-value }
  • 60. Going Meta • Possible meta-types: "label" Label a structure for reuse. "ref" Reuse a structure. "class" Associate a class with a structure. "type" Associate a special type, such as Date, with a structure.
  • 61. Browser Innovation • During the Browser War, innovation was driven by the browser makers. • In the Ajax Age, innovation is being driven by application developers. • The browser makers are falling behind.
  • 62. The Mashup Security Problem • Mashups are an interesting new way to build applications. • Mashups do not work when any of the modules or widgets contains information that is private or represents a connection which is private.
  • 63. The Mashup Security Problem • JavaScript and the DOM provide completely inadequate levels of security. • Mashups require a security model that provides cooperation under mutual suspicion.
  • 64. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" /> • A module is like a restricted iframe. The parent script is not allowed access to the module's window object. The module's script is not allowed access to the parent's window object.
  • 65. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" /> • The module node presents a send method which allows for sending a JSON string to the module script. • The module node can accept a receive method which allows for receiving a JSON string from the module script.
  • 66. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" /> • Inside the module, there is a global send function which allows for sending a JSON string to the outer document's script. • Inside the module, you can define a receive method which allows for receiving a JSON string from the outer document's script.
  • 67. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" />
  • 68. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" /> • Communiciation is permitted only through cooperating send and receive functions. • The module is exempt from the Same Origin Policy.
  • 69. The Mashup Security Solution <module id="NAME" href="URL" style="STYLE" /> • Ask your favorite browser maker for the <module> tag.