
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:
- 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).
- 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" 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:
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
Stay in the loop
Weekly insights on enterprise AI, knowledge graphs, and data intelligence.