JSON-LD 是以 JSON 為基礎的連結資料格式,可定義 context 的概念,指定型別和屬性的詞彙。Gmail 支援
內嵌在 HTML 文件中的 JSON-LD 資料,並使用 @context 的 schema.org,如下列範例所示:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"name": "John Doe",
"jobTitle": "Graduate research assistant",
"affiliation": "University of Dreams",
"additionalName": "Johnny",
"url": "http://www.example.com",
"address": {
"@type": "PostalAddress",
"streetAddress": "1234 Peach Drive",
"addressLocality": "Wonderland",
"addressRegion": "Georgia"
}
}
</script>
注意:@type 鍵是保留的鍵名,應包含完整型別 URI 或 URI 片段 (在這種情況下,系統會假設有從提供的資料內容屬性衍生的 http://schema.org/ 前置字元)。
如需 JSON-LD 語法的完整規格和規定,請參閱 json-ld.org。您也可以測試結構化資料,試用 JSON-LD 並偵錯標記。