JSON-LD Official Website Documentation
repository·main·Indexed 21 days ago
https://github.com/json-ld/json-ld.orgSource code and documentation for the official JSON-LD website. Includes specifications for JSON-LD 1.1, a JSON-LD Test Suite for processor conformance, performance benchmarks, and guides for the interactive playground. Provides resources for Linked Data concepts, implementation algorithms (compact, expand, frame, normalize), and assets for official logos and buttons.
What's inside json-ld.org
- JSON-LD (JavaScript Object Notation for Linked Data) is a lightweight Linked Data format designed for human readability and machine parsability. It extends the standard JSON format to enable data interoperability at Web-scale by providing a way to uniquely identify objects and properties on the Web. It is particularly suited for JavaScript environments, Web services, and unstructured databases like CouchDB and MongoDB.
Understand the purpose of the Development Playground
mainThe Development Playground is an experimental environment used specifically to test UI updates and new features of
jsonld.js.Warning: This environment is not intended for general use. It shares most files with the stable playground but operates using a non-revision-controlled version of
jsonld.js, meaning it may contain unstable or experimental code.Use JSON-LD Framing to restructure data
mainJSON-LD Framing allows you to perform query by example and force a specific tree layout on a JSON-LD document.
Developers use Framing to restructure data retrieved from the Web to match the specific needs of their application. By restructuring the data before your application processes it, you can write simpler code for handling data from external sources.
Understand the JSON-LD modular specification architecture
mainJSON-LD is designed as a modular set of specifications. It is built upon two core base specifications, with all other features acting as layered extensions.
To use JSON-LD effectively, you should understand the relationship between these layers:
- The JSON-LD Syntax: The foundation that defines the JSON-based format for serializing Linked Data.
- The JSON-LD API: The programmatic layer providing algorithms for document transformations, such as applying or removing contexts.
- Extensions: Higher-level specifications like Framing or the RDF API that build upon the Syntax and API to provide specialized functionality.
Understand the JSON-LD Test Suite design
mainThe test suite verifies JSON-LD Processor conformance by categorizing tests into specific sections. Each section uses a different data structure and comparison method:
- compact: Uses
input,expected, andcontextdocuments. Results are compared via JSON object comparison. - expand: Uses
inputandexpecteddocuments. Results are compared via JSON object comparison. - frame: Uses
input,frame, andexpecteddocuments. Results are compared via JSON object comparison. - normalize: Uses
inputandexpecteddocuments. Results are compared via string comparison. - rdf: Uses
inputandsparqldocuments. The processor performs an RDF conversion, and the result is tested by executing anASKquery (contained in thesparqldocument) against a SPARQL endpoint. The test passes if the expected triples are extracted.
Version Compatibility: Unless
processingModeis explicitly set in a test entry, tests are compatible with bothjson-ld-1.0andjson-ld-1.1. IfprocessingModeis specified, ajson-ld-1.0processor should only run tests markedjson-ld-1.0, and ajson-ld-1.1processor should only run tests markedjson-ld-1.1.- compact: Uses
Set up local website development
mainThe website is built with Eleventy and deployed via Cloudflare Pages. To develop the site locally, use the following commands:
- Install dependencies:
npm i - Build static files to
_site/:npm run build - Rebuild files on changes (watch mode):
npm run watch - Serve the site with Cloudflare Pages feature support:
npm run pages(available at http://localhost:8788/)
# install dependencies npm i # to just build the static files to `_site/` npm run build # to rebuild the files on changes npm run watch # to serve `_site/` with Cloudflare Pages feature support npm run pages- Install dependencies:
Explore JSON-LD in the Playground
mainYou can interactively experiment with JSON-LD markup using the official online playground at https://json-ld.org/playground/How to add a new unit test
mainTo add a new unit test to the suite, follow these steps:
- Assign a number: Pick the next available unit test number (e.g.,
250). - Create the markup file: Create a
.jsonldfile in thetests/directory using your chosen number (e.g.,tests/rdf-250.jsonld). - Create the query file (for RDF tests): Create a
.jsonldor.sparqlfile in thetests/directory (e.g.,tests/rdf-250.sparql). - Register the test: Add the new test entry to
manifest.jsonld.
- Assign a number: Pick the next available unit test number (e.g.,
Read JSON-LD blog posts and use cases
mainFor practical perspectives and real-world application discussions, refer to blog posts such as:
- Building Meaningful Data APIs: Insights into using JSON-LD for API design.
- Webizing Databases: Using Linked Data in JSON-LD on Cloudant to expose database content as Linked Data.
Build JSON-LD icons from SVGs
mainYou can generate PNG versions of the icons from the source SVGs using the provided Makefile. Use
maketo build the assets andmake cleanto remove old PNG files.# To create the icons from SVG $ make # To clean up old pngs $ make cleanContribute to the JSON-LD Test Suite
mainTo contribute a new test or a fix to an existing one:
- Notify the community: Email the JSON-LD mailing list at
public-linked-json@w3.orgto announce your intention and the purpose of the change. - Clone the repository:
git://github.com/json-ld/json-ld.org.git - Submit changes: Submit your changes via GitHub pull request or via
git format-patchto thepublic-linked-json@w3.orgmailing list.
- Notify the community: Email the JSON-LD mailing list at
Create a multi-size favicon.ico
mainTo create a
favicon.icocontaining multiple sizes, follow these steps after runningmaketo generate the PNGs:- Open the largest file (
json-ld-data-64.png) in GIMP. - Go to File > Open as Layers...
- Select the 32px and 16px files.
- Export the result as
favicon.ico.
- Open the largest file (