JSON-LD

JSON-LD, or JavaScript Object Notation for Linked Data, is a method of transporting Linked Data using JSON - wikipedia

JSON-LD is a lightweight Linked Data format. It is easy for humans to read and write. It is based on the already successful JSON format and provides a way to help JSON data interoperate at Web-scale. JSON-LD is an ideal data format for programming environments, REST Web services, and unstructured databases such as CouchDB and MongoDB.

{ "@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", "@type": "@id" }, "Person": "http://xmlns.com/foaf/0.1/Person" }, "@id": "http://me.markus-lanthaler.com", "@type": "Person", "name": "Markus Lanthaler", "homepage": "http://www.tugraz.at/" }

# Goals

It was a goal to require as little effort as possible from developers to transform their existing JSON to JSON-LD. This allows data to be serialized in a way that is similar to traditional JSON - w3.org

Here is a post about the things that make JSON-LD different from the traditional Semantic Web / Linked Data stack of technologies and why we decided to design it the way that we did.

It's also well worth reading Why I Hate the Semantic Web - manu.sporny.org

# Basics

If you don’t know what JSON-LD is and you want to find out why it is useful, check out this video on Linked Data:

YOUTUBE 4x_xzT5eF5Q A short non-technical introduction to Linked Data, Google's Knowledge Graph, and Facebook's Open Graph Protocol.

and this one on an Introduction to JSON-LD:

YOUTUBE vioCbTo3C-4 A short introduction to JSON-LD for Web developers, designers, and hobbyists. It covers how to express basic Linked Data in JSON.

# Embedding JSON-LD in HTML

HTML script tags can be used to embed blocks of data in documents. This way, JSON-LD content can be easily embedded in HTML by placing it in a script element with the type attribute set to application/ld+json - w3.org

<script type="application/ld+json"> { "@context": "http://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon" } </script>

This text-item (yes this one edit me), is an HTML element that includes the above JSON-LD Javascript. Note, if you do not include any other text the HTML is saved, but there is no way to see or edit it! Should check to see if it served and what that means?

Depending on how the HTML document is served, certain strings may need to be escaped.

# About

It is a World Wide Web Consortium Recommendation that has been developed by the JSON for Linking Data Community Group before it has been transferred to the RDF Working Group for review, improvement, and standardization.

JSON-LD is designed around the concept of a "Context" to provide additional mappings from JSON to an RDF model. The context links object properties in a JSON document to concepts in an ontology.

In order to map the JSON-LD syntax to RDF, JSON-LD allows values to be coerced to a specified type or to be tagged with a language.

A context can be embedded directly in a JSON-LD document or put into a separate file and referenced from different documents (from traditional JSON documents via an HTTP Link header).

This specification adds authentication and integrity protection to Linked Data documents through the use of public/private key cryptography without sacrificing Linked Data features such as extensibility and composability - web-payments.org