JSON-LD
The JSON-LD (JavaScript Object Notation, Linked Data) encoding is a lightweight data format that can be easy for humans to both read and write. Based on a standard JSON document, JSON-LD adds conventions and annotations for enforcing data conventions.
Example
{
"@context": "https://schema.org/",
"@type": "WebSite",
"name": "Named Graph",
"url": {
"@id": "https://www.namedgraph.com/"
}
}
Real World | ng:Inspector |
---|---|
RDF Vocabulary | Snapshot |
Schema.org Vocabulary | Snapshot |
W3C RDF Test Suite example | Snapshot |
Common Errors
Language Tag Not Well-formed
All language tags must be well-formed according to BCP47 and its Tags for Identifying Languages. Other values may be transformed into their canonical form.
Examples
Usage | Code |
Invalid | { "@value": "hello world", "@language": "en-us" } |
Invalid | { "@context": { "@language": "en-us" } } |
Valid | { "@value": "hello world", "@language": "en-US" } |
Unknown Keyword
The specification defines keywords using the @
-prefix convention. Any keywords not defined by the specification are not considered valid and may be ignored.
Examples
Usage | Code |
Invalid | |
{ "@context": { "example": "@example" } } | |
Valid | |
{ "@context": { "example": "https://example.com/" } } |
Limitations
- Blank node identifiers as property identifiers or types are not supported (and obsolete per specifications).
Technical Notes
- Reference: JSON-LD 1.1
- Media Type:
application/ld+json
(orapplication/json
) - File Name:
*.jsonld
(or*.json
)