Skip to content

Instantly share code, notes, and snippets.

@zazi
Created January 8, 2012 18:41
Show Gist options
  • Save zazi/1579271 to your computer and use it in GitHub Desktop.
Save zazi/1579271 to your computer and use it in GitHub Desktop.
A rough JSON-LD serialisation of the HAL example at https://gist.github.com/572481
{
"@context": {
"ex": "http://example.com",
"ex:customer": {
"@type": "@id"
},
"ex:quantity": {
"@type": "xsd:integer"
},
"ex:price": {
"@type": "xsd:float"
},
"ex:total": {
"@type": "xsd:float"
},
"ex:placed": {
"@type": "xsd:date"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "/orders",
"@type": "ex:Orders",
"ex:order": {
"@id": "/orders/123"
"@type": "ex:Order",
"ex:customer": "/customer/bob",
"ex:basket": {
"@id": "/orderds/123/basket",
"@type": "ex:Basket",
"ex:item": {
"@type": "ex:Item",
"ex:sku": "ABC123",
"ex:quantity": "2",
"ex:price": "9.50"
},
"ex:item": {
"@type": "ex:Item",
"ex:sku": "GFZT111",
"ex:quantity": "1",
"ex:price": "11.00"
},
},
"ex:total": "30.00",
"ex:currency": "USD",
"ex:status": "shipped",
"ex:placed": "2011-01-16"
},
"ex:order": {
"@id": "/orders/124"
"@type": "ex:Order",
"ex:customer": "/customer/jen",
"ex:basket": {
"@id": "/orderds/124/basket",
"@type": "ex:Basket",
"ex:item": {
"@type": "ex:Item",
"ex:sku": "KLM222",
"ex:quantity": "1",
"ex:price": "9.00"
},
"ex:item": {
"@type": "ex:Item",
"ex:sku": "HHI50",
"ex:quantity": "1",
"ex:price": "11.00"
},
},
"ex:total": "20.00",
"ex:currency": "USD",
"ex:status": "processing",
"ex:placed": "2011-01-16"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment