我可以在JSON中提供RSS吗? [英] Can I serve RSS in JSON?
问题描述
我正在写一个RSS feed(出于娱乐目的),并且正在查看规范此处.
I am writing an RSS feed (for fun) and was looking at the spec here.
RSS是XML的一种方言.所有RSS文件必须符合万维网联盟(W3C)网站上发布的XML 1.0规范.
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.就是说,如果我遵循其余的规范,(定制的)读者很可能能够解析它?
Obviously this means that I am not serving 'pure' RSS if I choose the JSON option. That said, if I conform to the rest of the spec, is it likely that (customised) readers will be able to parse it?
换句话说,如果我符合规范,但是使用JSON而不是XML可以使用RSS提要吗?
To put it another way, if I conform to the spec, but using JSON instead of XML is it a usable RSS feed?
编辑 我不确定自己是否清楚. 没有涉及XML.我想用JSON来写类似于RSS(XML)的东西.显然,需要编写此类提要的读者以了解JSON格式. 我想知道这是否已经完成.是否有以这种方式提供供稿的服务?是否有可以汇总/理解此格式的程序.在这种情况下,RSS规范(不含XML部分)是否是有用的规范?
edit I am not sure I made myself clear. There is no XML involved. I want to write something akin to RSS (which is XML) using JSON instead. Obviously the readers of such a feed would need to be written to understand the JSON format. I was wondering if this had been done already. Are there services that serve a feed this way? Are there programs that can aggregate/understand this format. Is the RSS spec (sans the XML part) a useful spec to conform to in this case?
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",
}
]
}
推荐答案
您是对的,客户端阅读提要必须具有对JSON的任何内容的自定义支持.因此,您要么需要创建一个自定义的提要阅读器来使用该信息,要么有人必须提出JSON提要标准,并且必须广泛采用它.
You're right that the client reading the feed would have to have custom support for whatever the particulars of your JSON were. So you'd either need to make a custom feed reader to consume that information, or someone would have to propose a JSON feed standard, and it'd have to be widely adopted.
好吧,我想您的愿望终于得到满足,朋友!
Well, I think your desires have finally been met, friend!
看看 JSON Feed .在撰写本文时,它只有大约一个星期的历史,但是已经得到了提速,已经得到 Feedly的支持, Feedbin ,新闻浏览器,
Take a look at JSON Feed. As of this writing it's only about a week old, but it's already picking up steam, having been supported now by Feedly, Feedbin, News Explorer, NewsBlur, and more being added all the time.
如果在生成RSS版本的JSON时必须选择要使用的标准,则可以肯定地选择JSON Feed.
If I had to pick a standard to use when generating a JSON version of RSS, I'd pick JSON Feed for sure.
这篇关于我可以在JSON中提供RSS吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!