Showing posts with label schema. Show all posts
Showing posts with label schema. Show all posts

Tuesday, September 08, 2009

SitePen Blog � JSON Namespacing

SitePen Blog � JSON Namespacing

JSON Hyper Schemas can be referenced from instances by Link headers or media type parameters. A simple example illustrates how JSON properties have universally locatable definitions:

Content-Type: application/json; schema=http://www.book-warehouse.com/book-schema
[
{"title": "Oliver Twist", "price": 16.99},
{"title": "Robinson Crusoe", "price": 15.99}
]

This message gives the authoritative URI for the schema. With a look at the schema, we can see how each property has a corresponding definition with an authoritative URI as well:

Content-Type: application/schema+json; schema=http://json-schema.org/hyper-schema
{ "properties": {
"title": {"type": "string", "description": "The title of the book"},
"price": {"type": "number", "description": "The price of the book in US"},
}
}