ToolZoneX
Blog

JSON-LD to N-Quads Converter

Paste a JSON-LD document to convert it into N-Quads, the plain-text line-based RDF format used by triple stores and linked-data tooling. Free online developer tool.

Paste JSON-LD Document
N-Quads
N-Quads output will appear here...

Free JSON-LD to N-Quads Converter

Paste a JSON-LD document to convert it into N-Quads — the plain-text, line-based RDF format most triple stores and linked-data tooling expect. Runs entirely in your browser using the official jsonld.js reference implementation.

How to Use It

Paste any JSON-LD document into the input box, or click "Load Example" to see a sample run. The tool expands your document into RDF triples/quads internally, then serializes each one as a single N-Quads line ending in a period. The output is plain text, not JSON.

Example

The sample document above converts to two N-Quads lines — one for the name statement and one for the homepage statement — each written as <subject> <predicate> object ., with the subject resolved to the document's @id and the predicates spelled out as full IRIs.

Common Use Cases

  • Loading JSON-LD data into a triple store or SPARQL engine that expects N-Quads input.
  • Inspecting a document's data as individual RDF statements rather than nested JSON.
  • Converting linked-data documents for interchange with non-JSON RDF tooling.
  • Debugging exactly which triples a JSON-LD document actually produces.

FAQs

What is N-Quads, and why does the output look so different from JSON?

N-Quads is a plain-text, line-based RDF serialization — every line is one subject-predicate-object statement (a "quad," optionally with a fourth graph name), terminated with a period. It has nothing to do with JSON syntax; it's the format most RDF tooling (triple stores, SPARQL engines, linked-data pipelines) expects as an interchange format, so this tool converts your JSON-LD document into that statement-per-line form.

Is this the same as the Normalized / URDNA2015 output?

No, and this is the most common point of confusion between the two tools. This N-Quads tool just runs jsonld.js's toRDF conversion once and prints whatever order it produces — running the same document through it twice will generally give you the same result, but the ordering isn't a canonicalization guarantee, and isn't guaranteed to be stable across different-but-equivalent input documents (different key order, different blank node labels, etc.). If you need a byte-for-byte deterministic output — for hashing or digitally signing a JSON-LD document — use the Normalized (URDNA2015) tool instead, which sorts and relabels everything into one canonical form regardless of how the input was written.

Does this tool support remote @context URLs (like https://schema.org/)?

No — this tool intentionally disables network fetches for @context and document dereferencing, since a static, client-side tool can't reliably rely on a remote server's CORS policy or availability. Use a document with an inline @context object (a JSON object, not a URL string) — the sample document above and virtually every hand-written JSON-LD example works this way. If you paste a document whose @context is a URL, you'll get a clear error instead of an unpredictable network failure.

Is my document uploaded anywhere?

No — all JSON-LD processing happens entirely client-side in your browser using the jsonld.js library. Nothing you paste is sent to a server.