我正在编写一个 RSS 提要(为了好玩)并且正在查看规范 here .
RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium (W3C) website.
显然,如果我选择 JSON 选项,这意味着我不会提供“纯”RSS。也就是说,如果我符合规范的其余部分,(定制的)读者是否有可能解析它?
换句话说,如果我符合规范,但使用 JSON 而不是 XML,它是可用的 RSS 提要吗?
编辑 我不确定我说清楚了。 不涉及 XML。我想改用 JSON 编写类似于 RSS(即 XML)的内容。显然,此类提要的读者需要了解 JSON 格式。 我想知道这是否已经完成了。是否有以这种方式提供提要的服务?是否有程序可以聚合/理解这种格式。在这种情况下,RSS 规范(没有 XML 部分)是否是一个有用的规范?
rg
{
"title":"example.com",
"link":"http://www.example.com/",
"description":"Awesome news about junk",
"items":[
{
"title":"An article",
"link":"http://www.example.com/an-article",
"descrition":"Some sample text here",
"pubDate":"2008-10-27 11:06 EST",
"author":"example author",
},
{
"title":"Second",
"link":"http://www.example.com/Seond",
"descrition":"Some sample text here",
"pubDate":"2008-10-25 23:20 EST",
"author":"author mcauthor",
},
{
"title":"third article",
"link":"http://www.example.com/third-article",
"descrition":"Some sample text here",
"pubDate":"2008-10-25 23:18 EST",
"author":"some other author",
}
]
}
最佳答案
不,RSS 是一种基于 XML 的格式,而 JSON 是一种不同的语言,而不是某种方言。 RSS 阅读器无法理解 JSON。
你的问题类似于问“我可以用中文说法语吗?”
关于xml - 我可以在 JSON 中提供 RSS 服务吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/246577/