JSON-LD to Flattened Form — Numio
Flattens a JSON-LD document with jsonld.flatten: every node, including nested ones, becomes a top-level entry in @graph, and nested objects are replaced by {"@id"} references. Unnamed nodes get blank node ids like _:b0.
Turning deeply nested JSON-LD into a flat list of nodes that is easy to index by @id or load into a store.
When to use it
- Turning deeply nested JSON-LD into a flat list of nodes that is easy to index by @id or load into a store.
- Finding which nested objects have no @id, since they show up as _:b blank nodes.
How to use
- Paste the document into the JSON-LD editor.
- Put the context to compact the result with in the Context editor, for example {"@context": {"@vocab": "http://schema.org/"}}.
- Read the @graph array, which lists each node once, sorted by @id.
JSON-LD + context
// JSON-LD editor
{
"@context": {"@vocab": "http://schema.org/"},
"@id": "http://example.org/order/7",
"@type": "Order",
"customer": {"name": "Jane Doe"},
"orderedItem": [
{"@id": "http://example.org/product/42", "name": "Lamp"}
]
}
// Context editor
{"@context": {"@vocab": "http://schema.org/"}}Flattened JSON-LD
{
"@context": {
"@vocab": "http://schema.org/"
},
"@graph": [
{
"@id": "_:b0",
"name": "Jane Doe"
},
{
"@id": "http://example.org/order/7",
"@type": "Order",
"customer": {
"@id": "_:b0"
},
"orderedItem": {
"@id": "http://example.org/product/42"
}
},
{
"@id": "http://example.org/product/42",
"name": "Lamp"
}
]
}Details and limitations
The Context editor is required and must hold valid JSON; the result is compacted with it.
Blank node ids (_:b0, _:b1, …) are assigned during processing and are not stable identifiers.
Runs in your browser with jsonld.js. Remote contexts in either editor are fetched by your browser. If the download fails, the page shows an error naming the context URL.
FAQ
What happens to nested objects?
Each nested object becomes its own entry in @graph and the parent keeps only a reference, such as "customer": {"@id": "_:b0"}.
Why is a single-item array shown as an object?
Because the result is compacted, a property with one value (orderedItem above) is written without the array.
Is the same node merged if it appears twice?
Yes. Nodes with the same @id are merged into one entry with all their properties.