JSON-LD To Compacted
Compact expanded JSON-LD documents using a JSON-LD context with real-time browser-side processing.
Compact expanded JSON-LD with a context
JSON-LD documents can be expressed in expanded form with full IRIs as keys, or in
compact form with short terms defined by an @context. Compaction makes
linked data easier to read, edit, and embed in applications while preserving semantic
meaning.
What this tool does
Provide an expanded JSON-LD document and a separate JSON-LD context object. The converter applies the W3C JSON-LD compaction algorithm and returns a compact JSON document with short property names mapped from your context.
When to use compaction
- Normalize API responses that use expanded IRIs into developer-friendly keys.
- Prepare JSON-LD for storage or editing with human-readable property names.
- Compare semantic graphs using a shared vocabulary context.
- Integrate schema.org or custom vocabularies into application payloads.
Related tools
Need the reverse operation? Use JSON-LD to Expanded to expand compact documents into fully qualified IRIs. For general JSON formatting, try the JSON to YAML Converter.
Frequently Asked Questions
What is JSON-LD context?
A JSON-LD context maps short terms to IRIs and can define type coercion rules. Compaction uses this mapping to replace long IRIs in expanded documents with compact keys.
Does processing happen in the browser?
Yes. This tool uses the jsonld.js processor locally. Your documents are not uploaded to a server.
Why do I need two inputs?
Compaction requires both the expanded JSON-LD graph and the context that defines how terms should be shortened. The context is typically the same vocabulary mapping used when the data was originally authored.
What if compaction fails?
Invalid JSON, incompatible context mappings, or malformed JSON-LD structures will show an error in the output panel. Verify both inputs are valid JSON and that context terms match properties in the expanded document.