Last active
December 15, 2019 14:33
-
-
Save Sheikh2Imran/d772754e04adfdb56ffdde3f35889421 to your computer and use it in GitHub Desktop.
Convert xml object to json
This file contains hidden or 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
| from xml.etree.ElementTree import fromstring | |
| from xmljson import parker | |
| xml_data = | |
| <?xml version="1.0"?> | |
| <COMMAND> | |
| <ID>2341</ID> | |
| <NAME>"testname"</NAME> | |
| <EMAIL>"testemail@gmail.com"</EMAIL> | |
| <PASSWORD>test1234</PASSWORD> | |
| </COMMAND> | |
| def decode_response_data(xml_data): | |
| return dict(parker.data(fromstring(xml_data))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment