JSON-LD

JSON-LD 是一种基于 JSON 的关联数据格式,它定义了 context 的概念,用于指定类型和属性的词汇。 Gmail 支持在 HTML 文档中嵌入 schema.org 类型的 JSON-LD 数据,如下例所示:@context

<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 并调试标记。