jsonld.js implements JSON-LD processing in JavaScript for compacting, expanding, framing, and converting linked data in web and Node environments.
Overview
jsonld.js is a library that implements the JSON-LD specifications for representing linked data as JSON. It adds semantics to JSON documents through contexts and supports interoperability between JSON-based services and RDF-oriented toolchains.
The processor exposes operations such as compact, expand, flatten, frame, canonize, and conversions to and from N-Quads RDF. It aims to conform with JSON-LD 1.0 recommendations and tracks newer 1.1 drafts as development allows. A safe mode helps detect constructs that drop data, which matters for digital signing workflows.
You can install it with npm for Node or bundle it for browsers, including minified builds with different module strategies and CDN distributions. Related projects listed upstream include a command-line jsonld tool and jsonld-request for reading from files, URLs, and stdin. Optional custom document loaders and RDF parsers can be plugged in.
The library is suited to web services, document stores, and client-side applications that need to publish or consume JSON-LD without adopting a full RDF stack separately.
Key features
- Compact and expand JSON-LD
- Framing and flattening
- RDF N-Quads conversion
- Normalization for signing
- Browser and Node bundles
- Custom document loaders
- Conformance test harness support
- Safe mode for data loss checks
Use cases
- Semantic web APIs
- Linked data in JSON stores
- Signed structured documents
- Browser-based JSON-LD tooling