views:

44

answers:

1

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.

http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/wsSearch?term=jack+johnson&country=US&media=music&entity=musicArtist&limit=6&genreId=&version=2&output=json&callback=jsonp1279429984094

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.

A: 

It's quite easy to do with Yahoo! Pipes or with YQL. This is what I ended up with when using this query:

select * from json
    where url='http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/wsSearch?term=jack+johnson&country=US&media=music&entity=musicArtist&limit=6&genreId=&version=2&output=json&callback='

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'

bluesmoon
Chris Jacob
Because my other comment has crazy width issues here the last part again... I can see that YQL can do the conversion from JSON to XML but... Can I reformat the XML into an RSS structure? as per my question: > I would like to consume this JSON result as an XML feed (to be read by any standard feed reader). Better yet can I reformat the XML into the iTunes Podcast RSS structure :-) http://www.apple.com/itunes/podcasts/specs.html * Bonus Points! * If you're able to figure this one out I will gladly accept your answer :-)
Chris Jacob
yeah, the URL breaks because stackoverflow doesn't understand * in a URL. Anyway, to convert this XML to RSS or iTunes, I'd pass it on to pipes and use the item builder in a loop. I'd do it for you, but don't have the time right now.
bluesmoon
Your answer was the most correct - so I accepted. I don't expect you to do my job for me - so that's totally fine. If I get this working I will post instructions for a Yahoo Pipes solution.... However if you do get a spare moment I would love to see you're version. Thx for pointing me in the right direction ^_^
Chris Jacob