Module json_ld
Available on crate features
http and std only.Expand description
JSON-LD transport, response, and HTML embedding support.
JsonLd contains valid JSON encoded so it is safe both as an application/ld+json response body and inside an HTML script type=“application/ld+json” data block. It deliberately does not implement JSON-LD expansion, compaction, context loading, or vocabulary validation.
The HTML serializer escapes every literal less-than sign as \u003c. HTML parses a script element’s raw text before considering its type, so an otherwise inert JSON-LD string containing a script end tag could terminate the element. The JSON escape preserves the string value while removing that HTML parser boundary.
Structs§
- Embedded
Json Ld - A valid JSON-LD data block borrowed from an HTML document.
- Extract
Json Ld - A lazy iterator over JSON-LD data blocks embedded in HTML.
- JsonLd
- A valid, script-data-safe JSON-LD document.
- Json
LdScript html - An HTML script type=“application/ld+json” data block.
Enums§
- Extract
Json LdError - Error yielded while extracting an embedded JSON-LD document.
Functions§
- extract_
from_ html - Lazily extract embedded JSON-LD documents from an HTML string.