pyld flatten¶
Requires pip install PyLD[cli]
Flatten a JSON-LD document. Add --context to compact the flattened output.
pyld flatten --help
Usage: pyld flatten [OPTIONS] {INPUT}
Flatten a JSON-LD document.
╭─ Arguments ──────────────────────────────────────────────────────────────────────────╮
│ * INPUT <str> Path or HTTP(S) URL. Pass - to read from standard input. │
│ [required] │
╰──────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────╮
│ --context -c <str> Output context path or │
│ URL. Pass - to read JSON │
│ from standard input. │
│ --expand-context <str> Context path or URL. │
│ Pass - to read JSON from │
│ standard input. │
│ --base <str> The base IRI to use. │
│ --extract-all-scripts --no-extract-all-scri… Extract all JSON-LD │
│ script elements from │
│ HTML, or just the first. │
│ --help Show this message and │
│ exit. │
╰──────────────────────────────────────────────────────────────────────────────────────╯
Usage: pyld flatten [OPTIONS] {INPUT}
Flatten a JSON-LD document.
╭─ Arguments ──────────────────────────────────────────────────────────────────────────╮
│ * INPUT <str> Path or HTTP(S) URL. Pass - to read from standard input. │
│ [required] │
╰──────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────╮
│ --context -c <str> Output context path or │
│ URL. Pass - to read JSON │
│ from standard input. │
│ --expand-context <str> Context path or URL. │
│ Pass - to read JSON from │
│ standard input. │
│ --base <str> The base IRI to use. │
│ --extract-all-scripts --no-extract-all-scri… Extract all JSON-LD │
│ script elements from │
│ HTML, or just the first. │
│ --help Show this message and │
│ exit. │
╰──────────────────────────────────────────────────────────────────────────────────────╯
Example¶
pyld flatten docs/examples/data/person.jsonld[
{
"@id": "_:b0",
"http://schema.org/name": [
{
"@value": "Ada Lovelace"
}
]
}
]
{
"@id": "_:b0",
"http://schema.org/name": [
{
"@value": "Ada Lovelace"
}
]
}
]
Source person.jsonld