Skip to main content

rdflib extension adding JSON-LD parser and serializer

Project description


This `rdflib <>`_ plugin is deprecated for, as of the 2021-09-17 release of rdflib 6.0.1, JSON-LD handing has been integrated. All functionality in this package has been removed, as of release 0.6.2.

This plugin is now ‘tombstoned’ meaning this - 0.6.2 - is a final release and all users of Python > 3.6 are encouraged to move to rdflib > 6.0.1.

If you are forced to keep using Python <= 3.6, you will need to keep using release <= 0.5.0 of this plugin with RDFlib 5.0.0.

This is an implementation of JSON-LD for RDFLib. For more information about this technology, see the JSON-LD website.

This implementation will:

  • read in an JSON-LD formatted document and create an RDF graph
  • serialize an RDF graph to JSON-LD formatted output


The easiest way to install the RDFLib JSON-LD plugin is directly from PyPi using pip by running the command below:

pip install rdflib-jsonld

Otherwise you can download the source and install it directly by running:

python install

Using the plug-in JSONLD serializer/parser with RDFLib

The plugin parser and serializer are automatically registered if installed by setuptools.

>>> from rdflib import Graph, plugin
>>> from rdflib.serializer import Serializer

>>> testrdf = """
... @prefix dcterms: <> .
... <>
...     dcterms:title "Someone's Homepage"@en .
... """

>>> g = Graph().parse(data=testrdf, format='n3')

>>> print(g.serialize(format='json-ld', indent=4))
    "@id": "",
    "": [
            "@language": "en",
            "@value": "Someone's Homepage"

>>> context = {"@vocab": "", "@language": "en"}
>>> print(g.serialize(format='json-ld', context=context, indent=4))
    "@context": {
        "@language": "en",
        "@vocab": ""
    "@id": "",
    "title": "Someone's Homepage"

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rdflib-jsonld, version 0.6.2
Filename, size File type Python version Upload date Hashes
Filename, size rdflib_jsonld-0.6.2-py2.py3-none-any.whl (4.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size rdflib-jsonld-0.6.2.tar.gz (12.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page