Offline JSON-LD expander and compactor
Expand or compact JSON-LD 1.1 with inline contexts and a supplied local URL-to-context map, without fetching remote documents.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Inspect the full IRIs behind a JSON-LD document, or make expanded data readable with a chosen context. Supply every remote context locally and download the processor result with a visible node and context-load summary.
How to use this tool
- Open or paste a JSON-LD object or array and select expand or compact.
- Provide exact local context documents and, for compaction, compactContext in the secondary JSON envelope. Set the document base explicitly if relative IRIs need one.
- Review node count, mapped contexts and any empty result, then download the resulting JSON-LD.
Supported inputs and limits
One UTF-8 file or pasted JSON-LD document up to 1 MiB; one secondary JSON envelope up to 1 MiB. Each has at most 10,000 JSON values and nesting depth 32. Duplicate keys, nonfinite values and unsafe integers reject rather than silently changing data. The result is limited to 10 MiB, 200,000 JSON values and depth 64. Selected file takes precedence.
Processing mode is fixed to JSON-LD 1.1. Secondary input is {"contexts":{"https://example.com/context":{"@context":{...}}},"compactContext":{...}}. Only these two envelope keys are supported. Each mapped document must contain @context; at most 32 exact absolute HTTP(S) URL keys and 64 loader calls. A missing URL always rejects; no fetch, redirects, registry, HTTP headers or scripts.
Choose expand or compact. Compact requires a supplied non-null compactContext, which can refer to a locally mapped URL. The document-base field must be empty or an absolute IRI; empty supplies no document base. Inline @base declarations still have their normal JSON-LD meaning. Unbound terms may disappear, and an empty expansion is a valid result.
Results preserve JSON-LD processing semantics, not original key ordering or number spelling. Numeric values use finite IEEE-754 doubles; unsupported unsafe integers reject. This task provides no RDF inference, SPARQL, signature validation or reconstruction of the input text. Preview shows the first 200 top-level nodes; the JSON-LD download is complete. The CSV download is a complete top-level node summary with index, IRI and key list, independently limited to10 MiB; exceeding it rejects the entire run without partial files.
Worked example
Example input
{"@context": {"name": "https://example.com/name"}, "@id": "https://example.com/alice", "name": "Alice"}Example options
{"secondary": "{\"contexts\": {}, \"compactContext\": {\"name\": \"https://example.com/name\"}}", "params": {"operation": "expand", "base": "https://example.com/"}}Example output
[
{
"@id": "https://example.com/alice",
"https://example.com/name": [
{
"@value": "Alice"
}
]
}
]When something does not work
Fix the first JSON/context error, supply every missing context under its exact URL, and rerun the example to confirm recovery. For compaction, add compactContext. Check term IRIs and the explicit base before accepting an empty or relative result.
Frequently asked questions
Can it fetch a remote context?
No. Supply an inline context or an exact URL-to-local-document mapping; a missing mapping fails.
Why did my property disappear?
A term without an IRI mapping can disappear during expansion. This is expected JSON-LD behavior; check the supplied context.
Can I compact with a context URL?
Yes, if that exact URL is mapped to a local document containing @context. The browser never dereferences it.
Documentation & further reading
Related tools
JSON formatting workspace
Format or minify strict JSON, sort object keys, and encode or decode strings while preserving raw number tokens.
Regex tester
Try a pattern and see what it matches in your text.
Compare text
See what changed, side by side.
HTML formatter
Format HTML indentation so its structure is easier to read.