Skip to content

Instantly share code, notes, and snippets.

View riconroy's full-sized avatar

rick conroy riconroy

  • Toronto ON
View GitHub Profile
@riconroy
riconroy / gist:bafc6c64e74a4fda0945
Last active March 21, 2016 16:13
This recursive Python routine parses an XML file to a JSON file, with the added requirement that the XML can have multiple equal tags that become a list (array). See example in listing below.
# example XML:
# <maximum-temperatures>
# <temperature year="2012" units="C">37</temperature>
# <temperature year="2013" units="C">38</temperature>
# </maximum-temperatures>
#
# would ouput:
#
# "maximum-temperatures": {
# "temperature": [