Json at work overview and ecosystem-v2.1
Transcript of Json at work overview and ecosystem-v2.1
JSON Beginnings
www.json.org
2001 - Douglas Crockford
2006 - IETF - RFC 4627
The “x” in AJAX
Lightweight / simple structures
Tuesday, February 19, 13
JSON Validation
Structure Instance Document [Well-formed]
Semantics Schema [Order, Person]
Tuesday, February 19, 13
JSON Object{ "address" : { "line1" : "555 Main Street", "city" : "Denver", "stateOrProvince" : "CO", "zipOrPostalCode" : "80202", "country" : "USA" }}
Tuesday, February 19, 13
JSON Array"clubs" : [ { "number" : 677476, "name" : "Simply Speaking", "city" : "Aurora", "district" : 26 }, { "number" : 999999, "name" : "Wry Toast", "city" : "Denver", "district" : 26 }]
Tuesday, February 19, 13
Numbers
"age": 29"cost": 299.99"temperature": -10.5"speed_of_light": 1.23e11"speed_of_light": 1.23e+11"speed_of_light": 1.23E11"speed_of_light": 1.23E+11
Tuesday, February 19, 13
null
{ "address": { "line1": "555 Main St.", "line2": null, "city": "Bailey", "state": "CO", "postalCode": 80909, "country": "USA" }}
Tuesday, February 19, 13
A Bigger Sample{ "member": { "firstName": "John", "lastName": "Smith", "joined": "2008-12-06", "language": "US English", "reason": "To improve my public speaking skills. To take over the world.", "address": { "line1": "555 Main St.", "city": "Bailey", "state": "CO", "postalCode": 80909, "country": "USA" }, "contact": { "email": "[email protected]", "homePhone": "303-555-1212", "cellPhone": "720-555-1212", "workPhone": "970-555-1212" }, "club": { "number": 677476, "name": "Simply Speaking", "city": "Aurora", "district": 26 } }}
Tuesday, February 19, 13
Date Property Values - RFC 3399
{ "dateJoined": "2007-11-06T16:34:41.000Z"}
Tuesday, February 19, 13
JSON Validators
JSON Validator (Mac)
http://www.jsonlint.com
Tuesday, February 19, 13
JSON Modeling ToolsJSON Designer
JSONPad
http://www.jsoneditoronline.org
http://www.jsonschema.net
Overly - Generate Schema
Matic - Generate HTML
Tuesday, February 19, 13
JSON and HTML5 & JavaScript - AJAX
$.getJSON('http://example/service/addresses/home/1', function(data) { var address = JSON.parse(data); console.log("Address Line 1 = " + address.line1); });
Tuesday, February 19, 13
JSON Schema
Defines JSON document structure
http://json-schema.org/
Tuesday, February 19, 13
JSON Schema Constructs
Construct Description
type The data type – object, array, string, number, etc.
required true / false
id Data element id
properties Additional validation properties for a data element (e.g., minimum, maximum, etc.)
Tuesday, February 19, 13
JSON Schema Validators
JSON Schema Validator Language Source
JSV JavaScript https://github.com/garycourt/JSV
Ruby JSON Schema Validator
Ruby https://github.com/hoxworth/json-schema
json-schema-validator
Java https://github.com/fge/json-schema-validator
php-json-schema (by MIT)
PHP https://github.com/hasbridge/php-json-schema
JSON.Net .NET http://james.newtonking.com/projects/json-net.aspx
Tuesday, February 19, 13
Questions?Tom Marrs
Architect
http://www.linkedin.com/in/TomMarrs
Twitter: @TomMarrs
Skype: t.marrs
Tuesday, February 19, 13
JSON ResourcesJSON Spec - http://tools.ietf.org/html/rfc4627
JSON.org - http://www.json.org
JSONLint - http://www.jsonlint.com
JSON Editor Online - http://jsoneditoronline.org/
Tuesday, February 19, 13
JSON ResourcesJSON SH - http://jsonsh.com/
JSON Schema Generator - http://jsonschema.net
JSON Schema Validator - http://json-schema-validator.herokuapp.com/
JSON Schema Spec - http://tools.ietf.org/html/draft-zyp-json-schema-03
Google JSON Style Guide - http://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml
Tuesday, February 19, 13
JSON ResourcesJSONQuery - https://github.com/jcrosby/jsonquery
JSONPath - http://goessner.net/articles/JsonPath/
JSONiq - http://www.jsoniq.org/
JSONT - http://goessner.net/articles/jsont/
Tuesday, February 19, 13
JSON Groups
Google - http://groups.google.com/group/json-schema
Yahoo! - http://tech.groups.yahoo.com/group/json/
Tuesday, February 19, 13