I'm attempting to write an xml as a json object. the xml object is authreq_data = """ <req> <body> <username>%s</username> <productType>CFD_Demo</productType> <password>%s</password> </body> </req>""" %(username, password)