Last active
December 20, 2023 19:49
-
-
Save mkorthof/dd1dfbda7051301ad23f08d439919346 to your computer and use it in GitHub Desktop.
conv json to xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Source: https://github.com/quandyfactory/dicttoxml/blob/master/README.markdown | |
# page = urllib.urlopen('http://quandyfactory.com/api/example') | |
import json | |
import urllib | |
import dicttoxml | |
import sys | |
if (len(sys.argv) > 1): | |
page = open(sys.argv[1]) | |
else: | |
#page = open('/home/$USER/tmp/db_out.json') | |
page = open('/tmp/db_out.json') | |
content = page.read() | |
obj = json.loads(content) | |
print(obj) | |
xml = dicttoxml.dicttoxml(obj) | |
print(xml) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment