import xmltodict
import pprint
import json
xml_content = """
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
"""
"\n <note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n </note>\n"
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(json.dumps(xml_content))
('"\\n <note>\\n <to>Tove</to>\\n <from>Jani</from>\\n '
"<heading>Reminder</heading>\\n <body>Don't forget me this "
'weekend!</body>\\n </note>\\n"')