Converting XML to JSON using Python?

I’ve seen a fair share of ungainly XML->JSON code on the web, and having interacted with Stack’s users for a bit, I’m convinced that this crowd can help more than the first few pages of Google results can.

So, we’re parsing a weather feed, and we need to populate weather widgets on a multitude of web sites. We’re looking now into Python-based solutions.

This public weather.com RSS feed is a good example of what we’d be parsing (our actual weather.com feed contains additional information because of a partnership w/them).

In a nutshell, how should we convert XML to JSON using Python?

20 Answers
20

Leave a Comment