json at work overview and ecosystem-v2.1

68
JSON at Work - Overview and Ecosystem Tom Marrs Architect Tuesday, February 19, 13

Upload: tom-marrs

Post on 17-Jul-2015

423 views

Category:

Documents


1 download

TRANSCRIPT

JSON at Work -Overview and Ecosystem

Tom MarrsArchitect

Tuesday, February 19, 13

Your ProfileReally?

What else?

How?

Tuesday, February 19, 13

What’s The Point?

JSON -

much

more ...

Tuesday, February 19, 13

JSON Ecosystem

Tuesday, February 19, 13

Our Agenda

Tuesday, February 19, 13

We’re Not Covering :(-

REST

XML

SOA

Tuesday, February 19, 13

Where Are We?

Tuesday, February 19, 13

JSON Beginnings

www.json.org

2001 - Douglas Crockford

2006 - IETF - RFC 4627

The “x” in AJAX

Lightweight / simple structures

Tuesday, February 19, 13

That was Then ...JSON for Speed XML for Integration

Tuesday, February 19, 13

JSON Validation

Structure Instance Document [Well-formed]

Semantics Schema [Order, Person]

Tuesday, February 19, 13

This is NowJSON for Speed JSON for Integration

Tuesday, February 19, 13

JSON.org

Tuesday, February 19, 13

JSON Documents

{ "thisIs": "My First JSON Doc"}

Tuesday, February 19, 13

JSON Data Structures

Name/Value (or Key/Value) Pairs

Objects

Arrays

Tuesday, February 19, 13

JSON Key/Value Pair

{ "firstName": "John"}

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

JSON Value Types

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

JSON Boolean

{ "emailValidated": true}

Tuesday, February 19, 13

null

{ "address": { "line1": "555 Main St.", "line2": null, "city": "Bailey", "state": "CO", "postalCode": 80909, "country": "USA" }}

Tuesday, February 19, 13

JSON Comments

No

Tuesday, February 19, 13

JSON Versions

Never

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

Google JSON Style Guide

Tuesday, February 19, 13

Property Names

{ "somePropertyIdentifier": "some value"}

Tuesday, February 19, 13

Date Property Values - RFC 3399

{ "dateJoined": "2007-11-06T16:34:41.000Z"}

Tuesday, February 19, 13

JSON Dominates the Formats!

Tuesday, February 19, 13

JSON is Hot!

Tuesday, February 19, 13

Where Are We?

Tuesday, February 19, 13

JSON Tool Runtimes

Tuesday, February 19, 13

JSON Validators

JSON Validator (Mac)

http://www.jsonlint.com

Tuesday, February 19, 13

JSONLint.com

Tuesday, February 19, 13

JSON BeautifiersFirefox

JSONView

Chrome

JSONView

JSON SH

Tuesday, February 19, 13

JSON Without a Beautifier

Tuesday, February 19, 13

JSONView

Tuesday, February 19, 13

JSON SH

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

Model JSON Doc -JSONPad

Tuesday, February 19, 13

Model JSON Doc -jsoneditoronline.org

Tuesday, February 19, 13

JSON Tutorial - on the iPhone

Tuesday, February 19, 13

JSON Designer - on the iPhone

Tuesday, February 19, 13

JSON and HTML5 & JavaScript

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 and HTML5 Web Storage

Tuesday, February 19, 13

JSON Schema

Tuesday, February 19, 13

JSON Schema

Defines JSON document structure

http://json-schema.org/

Tuesday, February 19, 13

When To Use JSON Schema?

When crossing organizational boundaries

Tuesday, February 19, 13

When NOT to use JSON Schema?

Get a life - it’s just a website!

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

JSON Schema Example

Gift Registry Document & Schema

Tuesday, February 19, 13

JSON Modeling Flow

Tuesday, February 19, 13

Create JSON Schema - jsonschema.net

Tuesday, February 19, 13

Create JSON Schema - Orderly

Tuesday, February 19, 13

Validate JSON Document against JSON Schema

Tuesday, February 19, 13

Generate HTML Document from JSON Schema - Matic

Tuesday, February 19, 13

Where Are We?

Tuesday, February 19, 13

RESTing with JSON

Tuesday, February 19, 13

Where Are We?

Tuesday, February 19, 13

Text Search with JSON

JSONQuery

JSONPath

JSONiq

Tuesday, February 19, 13

Our Agenda

Tuesday, February 19, 13

What’s The Point?

JSON -

much

more ...

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