Skip to content

Standards

JSON-LD

A JSON-based serialization for linked data and RDF-compatible statements.

Kind
Formats
Steward
World Wide Web Consortium (W3C)

What it describes

JSON-LD expresses linked data in JSON while using a context to map terms to identifiers. It is widely used for web-page structured data and can be processed as RDF. The context is part of the interpretation: the same short property name can mean different things under different mappings. Keeping that context makes the data more portable than treating property strings as self-explanatory.

Valid JSON-LD does not establish that a publisher's assertions are true or that a consumer applies the intended vocabulary correctly. Remote contexts and external identifiers can change or become unavailable. Retain the original document, its context, retrieval date, and any normalized representation used for analysis. A parser's successful expansion is a syntax check, not a factual audit.

Structure

JSON document with linked-data keywords such as @context and @id, interpreted under JSON-LD 1.1.

Useful for

  • Exchange linked structured data.
  • Read web-page metadata.
  • Preserve term-to-IRI mappings.

Limits

  • Syntax does not prove truth.
  • Context changes can alter interpretation.
  • Remote resources may disappear.

How it is used in practice

JSON-LD lets ordinary JSON carry the meaning of its keys. A context maps short property names to IRIs, so that a key such as name means a specific property in a specific vocabulary. Keywords such as @id, @type and @graph let a document name things, give them types and group statements. Processors can expand a document to its full form, compact it against a different context, flatten it, convert it to RDF, or frame it into a particular tree shape. The same document is therefore both a JSON object that developers can read and a set of statements that a graph store can load.

It is the usual format for structured data embedded in web pages, and it is used in APIs and in documents that need to be verified, such as credentials. Because canonicalization algorithms exist for RDF datasets, signed JSON-LD documents can be verified independent of the order of keys or formatting.

A worked example

A fictional API returns an object with a key called status. Under the publisher's context, status maps to a property in a drug-regulatory vocabulary, and the value is a string. In a revised version of the API, the publisher changes the context so that status maps to a property in a generic project-management vocabulary. The JSON bytes are unchanged.

A consumer that processes the new context gets different RDF for the same JSON. A consumer that cached the old context keeps the old meaning. A reviewer reconstructing a past decision needs the document, the context in force when the document was received and the processing date. The record therefore stores the received bytes, the resolved context as retrieved, a hash of each and the retrieval time. If the context is remote and later disappears, the stored copy is the only evidence of what the keys meant.

Evaluating a claim that rests on JSON-LD

Look at the context first. Is it inline or remote? Is it versioned? Does it use a vocabulary setting that maps unknown keys into a default namespace, so that typos silently become valid terms? Run the expansion and inspect which keys were dropped, because a processor may ignore terms it cannot map.

Then evaluate the statements as you would any others: who published them, when, and with what support. Valid JSON-LD says nothing about truth. Embedded data in a page is also a claim of the page's publisher, and it may disagree with the visible text. The record should keep the original document, not only an extracted table of values, so a reviewer can redo the extraction.

Confusions to avoid

JSON-LD is not a schema language. It does not say which properties are required or what values are allowed. Those constraints come from another layer, such as a shapes language or an application profile, and passing a JSON-LD parser is not validation against them.

It is also not a different data model from RDF. It is a syntax for it, with some extra features, and a document that uses features with no RDF equivalent loses them on conversion. Finally, remote contexts introduce a dependency on a server. For documents that must remain readable, bundle or pin the contexts they need, and record their hashes.

Questions a reviewer can ask

Is the context inline or remote, and was it retained with a hash? What did expansion drop? Does the vocabulary setting hide misspelled keys? Is the document a publisher's assertion, and does the visible content agree? Which processor and version produced the RDF? Could another party, given the retained bytes and contexts, obtain the same graph?

Maintenance and change

JSON-LD documents age through their contexts. A context may be edited in place, moved to a new URL, split into versions or removed along with the site that hosted it. Some processors cache contexts aggressively, which can hide a change for a while and then reveal it all at once when the cache expires. Publishers who care about stability version their contexts at distinct URLs and keep old versions available. Consumers who care about reproducibility store the context they used. The specification also has a mode for documents that declare which processing rules they were written for, and documents should state it when it matters.

Found an error on this page? See corrections for what counts as one, how to report it and the dated log.

Enquiry

Which of your sources carry JSON-LD?

Tell us which sources carry it, which key the same entity some other way and who may read which. We reply with whether and how a first record would use this format.

Or write to [email protected] in your own words.