JSON-LD

JSON provides a simple representation of the key/value properties of an object:

item-1.json
{
  "id": "http://example-one.com/foo",
  "title": "bar",
  "published": "2013-01-01T12:00:00Z"
}

However, someone else might have chosen to use different names for those properties:

item-2.json
{
  "id": "http://example-two.com/foo",
  "name": "baz",
  "date_published": "2013-01-02T12:00:00Z"
}

Without needing anyone to change their data schema - apart from a backwards-compatible addition of one line - JSON-LD allows each data publisher to map their local property names to the URLs and data types of a shared ontology.

The mapping from local property names to ontology URLs is provided by a JSON-LD context document, linked from the data using a @context attribute:

item-1.json
{
  "@context": "context-1.jsonld",
  "id": "http://example-one.com/foo",
  "title": "bar",
  "published": "2013-01-01T12:00:00Z"
}
item-2.json
{
  "@context": "context-2.jsonld",
  "id": "http://example-two.com/foo",
  "name": "baz",
  "date_published": "2013-01-02T12:00:00Z"
}
context-1.jsonld
{
  "@context": {
    "id": {
      "@id": "http://schema.org/url",
      "@type": "@id"
    },
    "title": "http://schema.org/name",
    "published": {
      "@id": "http://schema.org/datePublished",
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  }
}
context-2.jsonld
{
  "@context": {
    "id": {
      "@id": "http://schema.org/url",
      "@type": "@id"
    },
    "name": "http://schema.org/name",
    "date_published": {
      "@id": "http://schema.org/datePublished",
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  }
}

A parser can then combine the context document and the actual data to produce linked data:

item-1.json
{
  "http://schema.com/url": "http://example-one.com/foo",
  "http://schema.org/name": "bar",
  "http://schema.org/datePublished": "2013-01-01T12:00:00Z"
}
item-2.json
{
  "http://schema.com/url": "http://example-two/foo",
  "http://schema.org/name": "baz",
  "http://schema.org/datePublished": "2013-01-02T12:00:00Z"
}
merged.turtle
<http://example-one.com/foo>
    <http://schema.org/name> "bar" ;
    <http://schema.org/datePublished> "2013-01-01T12:00:00Z"^^xsd:dateTime .
<http://example-two.com/foo>
    <http://schema.org/name> "baz" ;
    <http://schema.org/datePublished> "2013-01-02T12:00:00Z"^^xsd:dateTime .