Skip to content

JSON-LD to N-Quads Converter — Numio

Converts JSON-LD to RDF in N-Quads format with jsonld.toRDF. Each statement becomes one line of subject, predicate, object (and graph name for named graphs); nodes without @id become blank nodes such as _:b0.

Loading JSON-LD structured data into a triple store or RDF library that imports N-Quads.

JSON-LD

When to use it

  • Loading JSON-LD structured data into a triple store or RDF library that imports N-Quads.
  • Seeing exactly which RDF triples search engines or RDF tools will extract from your JSON-LD.

How to use

  1. Paste the JSON-LD document into the JSON-LD editor.
  2. Read the N-Quads output; @type becomes an rdf:type triple and nested objects become linked blank nodes.
  3. Copy the lines into an .nq file.

JSON-LD

{
  "@context": {"@vocab": "http://schema.org/"},
  "@type": "Person",
  "name": "Jane Doe",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Seattle"
  }
}

N-Quads

_:b0 <http://schema.org/address> _:b1 .
_:b0 <http://schema.org/name> "Jane Doe" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
_:b1 <http://schema.org/addressLocality> "Seattle" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/PostalAddress> .

Details and limitations

Blank node labels (_:b0, _:b1) are assigned during conversion and are not canonical; use the normalized page if you need stable labels.

Triples are in the default graph, so lines have no fourth element; named graphs (@graph with an @id) add a graph IRI.

Runs in your browser with jsonld.js; a remote @context such as https://schema.org/ is fetched by your browser. If the download fails, the page shows an error naming the context URL.

FAQ

Is N-Quads output valid N-Triples?

When everything is in the default graph, as here, each line is also valid N-Triples. Data in named graphs adds a graph column that N-Triples does not allow.

How are plain strings and numbers written?

Strings become plain literals like "Jane Doe"; JSON integers, decimals and booleans become typed literals: "3"^^xsd:integer, "1.5E0"^^xsd:double and "true"^^xsd:boolean (written with full IRIs).

Why are some keys missing?

Only keys that expand to IRIs through the @context produce triples; undefined terms are dropped.

Specifications and references