如何将 JSON 转换为 XML? (最好使用 Yahoo Pipes 或 Ruby)
有很多关于 XML 到 JSON 转换的信息...但我想将 JSON 结果转换为 XML。
例如,iTunes Search API 仅提供 JSON 格式的输出。
我想将此 JSON 结果用作 XML 提要(可由任何标准读取)提要阅读器)。
如果我可以将工作转移到 Yahoo Pipes,那就太好了(这是一项免费服务,可以减少我服务器上的负载)。
另一方面,我的网站是使用 Ruby / Sinatra 构建的 - 托管在 Heroku 上。
There is plenty of information on XML to JSON conversion... But I would like to convert a JSON result into XML.
For example the iTunes Search API only provides output in the JSON format.
I would like to consume this JSON result as an XML feed (to be read by any standard feed reader).
If I could offload the work to Yahoo Pipes that would be great (it's a free service and would reduce the load on my server).
As an side my site is being built with Ruby / Sinatra - hosted on Heroku.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用雅虎很容易做到!管道或与 YQL。这就是我使用此查询时得到的结果:
URL:
http: //query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D'http%3A%2%2Fitunes.apple.com%2FWebObjects%2FMZStoreServices .woa%2Fws%2FwsSearch%3Fterm%3Djack%2Bjohnson%26country%3DUS%26media%3Dmusic%26entity%3DmusicArtist%26limit%3D6%26genreId%3D%26version%3D2%26output%3Djson%26callback%3D'
It's quite easy to do with Yahoo! Pipes or with YQL. This is what I ended up with when using this query:
URL:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D'http%3A%2%2Fitunes.apple.com%2FWebObjects%2FMZStoreServices.woa%2Fws%2FwsSearch%3Fterm%3Djack%2Bjohnson%26country%3DUS%26media%3Dmusic%26entity%3DmusicArtist%26limit%3D6%26genreId%3D%26version%3D2%26output%3Djson%26callback%3D'