JSON-LD 简介

引自infoQ的介绍

W3C RDF工作组已将JSON-LD和JSON-LD 1.0处理算法与API标准推进到推荐状态。JSON-LD是一个标准,旨在向JSON中加入“链接数据(linked data)”语义。

JSON-LD简介

JSON-LD is a lightweight Linked Data format. It is easy for humans to read and write. It is based on the already successful JSON format and provides a way to help JSON data interoperate at Web-scale. JSON-LD is an ideal data format for programming environments, REST Web services, and unstructured databases such as CouchDB and MongoDB.

json-ld(全称:JavaScript Object Notation for Linked Data)是一个轻量级的链接的数据格式。人们读写的很容易。它是基于已经成功的JSON格式,提供了一种方法,在网络规模有助于JSON数据互操作。json-ld为编程环境,一个理想的数据格式,其余的Web服务,和非结构化的数据库如CouchDB和MongoDB。

官方是这样介绍其用途的:

Data is messy and disconnected. JSON-LD organizes and connects it, creating a better Web.

数据是混乱的、断开。JSON-LD组织并连接他们,以创造一个更好的网络。

链接的数据使人们发布和使用网络上的信息。这是一个方法来创建一个网络的基于标准的,机器可读的数据在Web站点。它允许应用程序在一个链接的数据开始,并遵循嵌入式链接到其他部分,托管在不同网站链接的数据。

JSON-LD示例

{
  "@context": "http://json-ld.org/contexts/person.jsonld",
  "@id": "http://dbpedia.org/resource/John_Lennon",
  "name": "John Lennon",
  "born": "1940-10-09",
  "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}

JSON-LD与Schema.org搭配

{
  "http://schema.org/name": "Manu Sporny",
  "http://schema.org/url": { "@id": "http://manu.sporny.org/" },  ← The '@id' keyword means 'This value is an identifier that is an IRI'
  "http://schema.org/image": { "@id": "http://manu.sporny.org/images/manu.png" }
}

其他

一想到这货是拿JSON表现数据,而MicroData是直接嵌入HTML。就觉得差距还是有的,但是Google已经支持了。。

在上一篇的《谷歌 Microdata之站内搜索》,我们看到两者间的使用。

这是一次标准间的较量,但是真心不喜欢这样的格式。


或许您还需要下面的文章:

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806