Blog Post Kevin Doubleday01.23.24

What is JSON-LD?

Future-Proof Your Data with JSON-LD

Fluree has officially released native JSON-LD support. But what exactly is JSON-LD, and why does it matter? 

For developers used to working with document data stores like MongoDB, JSON-LD is a bridge to the world of linked data. Linked data is the reason Google has been able to provide such unique and sophisticated services to consumers —  but that power is about to expand to far more than simple search engine optimization. Linked data allows organizations, people, and applications to access and share distributed sets of knowledge under global semantic standards- a powerful concept in the context of the modern data age.

At Fluree, we are big fans of the semantic web standards – especially RDF – because they allow for data to be organized and exchanged with universal meaning. Semantic standards are necessary for a future internet in which machines and humans can seamlessly connect to, leverage, and collaborate around disparate sets of linked data. The implications – especially in the era of emerging AI technologies, enterprise knowledge graphs, and industry data sharing ecosystems – are profound.

But we are also realists – in the last ten years, most developers have chosen convenience over the grand vision of the semantic web, opting for JSON document data stores. JSON’s incredibly lightweight interchange format has seen mass adoption thanks in part to the influence of javascript on software over the last decade. 

But the simplicity of JSON backfires when it comes to any case of reusing, sharing, or linking data. Without adding the context of data types, classifications, and relationships, data can easily become isolated, leading to a fragmented and siloed understanding of its implications.

That’s why we’re passionate about the JSON-LD specification — which Fluree has fully implemented and now supports.

What is JSON-LD?

JSON-LD — or JavaScript Object Notation Linked Data — combines the simplicity and ease of JSON documents with the power of linked data. JSON-LD allows you to encode meaning within your JSON document through the use of a shared vocabulary – a total upgrade from your typical JSON payload. 


JSON-LD is JSON for linked data. In fact, A JSON-LD document is always a valid JSON document. Broadly speaking, there are two core capabilities that the “LD” part provides:

  1. It allows you to embed or reference the definition of objects within your JSON payload. For example, the @context element embedded in a JSON-LD document maps object properties to concepts from an RDF ontology (a universally standardized schema).
  2. It allows you to assign IRIs to properties in order to establish uniqueness.

🔍 What is an IRI?

An IRI (Internationalized Resource Identifier) is a generalization of the more commonly known URI (Uniform Resource Identifier). While URIs are limited to a subset of the ASCII character set, IRIs provide a way to include characters from a wider range, including Unicode. This expansion allows for the use of scripts and characters from various languages around the world, making it more globally inclusive.

In the context of linked data and the semantic web, IRIs are used to uniquely identify resources. This ensures that there’s no ambiguity when referring to particular entities, concepts, or relationships, regardless of where they originate or the language they’re represented in.

Understanding @context, @id and @type

@context – The @context tag in a JSON-LD payload gives us just that – context – in the form of mapping objects in the document to a vocabulary. For example, one might map @context to schema.org, a well-known reference site for structured data schemas. 

@id – The @id tag gives us a way to establish uniqueness for data – which is fundamentally critical to prevent ambiguity and duplication in linked data systems. The @id tag is sort of like a digital version of an address where we can ‘park’ unique data at URIs and point to them later on. Uniqueness in data allows us to distinguish between things or recognize that one thing in a dataset is the exact same as one thing in another dataset. 

@type – Represents the data type or class of the object, providing a way to categorize the data in terms of what it represents in the real world.

Let’s take a look at a JSON-LD document:

{
  "@context": {
    "schema": "https://schema.org/",
    "name": "schema:name",
    "author": "schema:author",
    "datePublished": "schema:datePublished",
    "articleBody": "schema:articleBody"
  },
  "@type": "schema:Article",
  "@id": "https://example.com/articles/json-ld-introduction",
  "name": "Introduction to JSON-LD",
  "author": {
    "@type": "schema:Person",
    "name": "John Doe"
  },
  "datePublished": "2023-10-27",
  "articleBody": "JSON-LD is a powerful way to represent linked data using JSON. It combines the simplicity of JSON with the capabilities of linked data, allowing for richer metadata, better SEO, and improved data interoperability..."
}
  • @context: This defines the context of the JSON-LD document. It maps terms to IRIs so that properties such as “name” or “author” are clearly associated with concepts defined at “schema.org”, a popular vocabulary for structured data on the internet.
  • @type: Specifies that this JSON-LD document represents an article. The “schema:Article” IRI defines this as an article type as per the schema.org vocabulary.
  • @id: Provides a unique identifier for this article. In this case, it’s a URL to the article on “example.com”.
  • author: Contains information about the author of the article. Nested within it, we see another @type that specifies this entity as a “Person” as per the schema.org vocabulary. The author has a “name” property.

Why use JSON-LD?

JSON-LD gives developers a familiar format in which to deliver the value of linked data and provides organizations with an easy path to integrate the benefits of linked data into a broader range of their data management operations.

What’s the deal with Linked Data?

Linked data is the practice of connecting data across domains through the use of semantic standards. Linked data uses standardized schemas known as ontologies to transform information into organized, connected, and contextual knowledge. These properties allow data to become interlinked and machine-readable on the web and promote knowledge discovery and federated analytics. Linked data can be applied within the enterprise in the form of semantic knowledge graphs, on the public internet in the form of Open Linked Data, or in a hybrid model in the form of semantic data sharing ecosystems.

JSON-LD allows organizations to gain all the benefits of linked data – without the hassle and overhead of transforming data or forcing developers to use a foreign data format. JSON-LD immediately increases the value of JSON documents by making the data stored within them interoperable with other linked data systems – such as internal knowledge graphs or on the open linked web – as well as by providing an accessible medium for developers and applications to interact with linked data. 

Here’s a few examples of how JSON-LD makes an impact:

  • Building Data-Centric Applications – Software increasingly produces data that has more than one purpose – whether analytics, sharing, compliance reporting, or re-operationalization into a new application – data is versatile. JSON-LD future-proofs data for re-use within a data-centric architecture, allowing data to exist independently of a singular application and to power multiple data applications without duplication. Read more about data-centricity here.
  • Participation in the Semantic Web – JSON-LD gives document data a path towards participation in the semantic web. This core initial use case has seen wide adoption in the SEO (Search Engine Optimization) field, because JSON-LD helps add metadata and structure to webpages. Beyond SEO, JSON data will need to interoperate at webscale for a variety of use cases – and JSON-LD is the perfect tool for the job.
  • Broadening the Impact and Capabilities of Enterprise Knowledge Graphs: Linking data allows the formation of ontology-driven knowledge graphs, a data management trend that supports advanced analytics and insights through the use of semantic data standards. JSON-LD allows knowledge graphs to incorporate semantically-tagged documents as part of their data domains – but it also provides a medium in which to operationalize applications atop knowledge graphs. Knowledge graphs should be dynamic and operational in that they power multiple data applications and are contributed to by multiple data source domains. This is supported by our data-centric philosophy in which data should be able to connect to, influence and power multiple data applications. Because JSON-LD extends JSON with linked data capabilities, adding and deleting objects in knowledge graphs is as simple as performing transactions against a document database like MongoDB. This read/write capability then allows a knowledge graph to serve as an operational backend to real-time web-based applications that use a JSON interface
  • Feeding Analytics Better Data – JSON-LD extends the value and versatility of data with context, thereby preparing it for downstream activity. For instance, JSON-LD prepares data (that would otherwise be too simple or obscure) for an instantaneous analytical experience within data science teams. Because JSON-LD data arrives with self-describing context and a standardized semantic schema, downstream systems can immediately understand, evaluate, and take action on insights. For these systems, JSON-LD makes data immediately F.A.I.R. (Findable, Accessible, Interoperable and Reusable).
  • Machine-readability – JSON-LD upgrades JSON documents to become machine-readable, meaning computers can automatically exchange, access and understand information without the need for a human intermediary. This capability will be crucial for data to participate in the machine-to-machine web and power the next wave of automation and AI.
  • Data sharing ecosystems – Data sharing ecosystems are on the rise, introducing complexities that data systems have not had to account for in the past. For example, data from a single repository might be contributed to by multiple organizations. Or, records in a consortium might need to flow across systems and applications – in a hospital system, for example, patient information is securely collaborated on by different clinics and insurance providers. Linked data supports these complexities – with semantic standards, we can exchange information across systems, execute federate queries across multiple disparate data sets, and collaborate around data sets with standardized schemas.
  • Verifiable Credentials & Decentralized Semantics – Allows for authentication and assurance of the data’s source, ensuring its validity and credibility. By incorporating decentralized semantics, data gets rooted in a universally accepted framework, making it trustworthy and interoperable across a network. (check out our cool work with the Trusted Learner Network!)

Conclusion

At Fluree, our vision of the Web3.0 involves an internet of trusted and linked data. The problem is that our tools haven’t addressed the need for data to be linked – developers have found document databases quite preferable for simplicity’s sake. It’s time to prepare our data — at the source of its creation — with capabilities for interoperability and exchange across disparate data systems. JSON-LD is that needed bridge. Try JSON-LD out for yourself here. There are emerging innovations for trusted and interoperable data exchange that JSON-LD will help fuel – including personal knowledge graphs and verifiable credentials. We’ll cover examples of those specifications in future blog posts.

Resources

• https://json-ld.org/

• https://flur.ee/json-ld/

• https://www.slideshare.net/gkellogg1/json-for-linked-data