Skip to content

Instantly share code, notes, and snippets.

@Sheikh2Imran
Last active December 15, 2019 14:32
Show Gist options
  • Select an option

  • Save Sheikh2Imran/be2f029fc8d255c5d4f2fcdcb40f1c28 to your computer and use it in GitHub Desktop.

Select an option

Save Sheikh2Imran/be2f029fc8d255c5d4f2fcdcb40f1c28 to your computer and use it in GitHub Desktop.
Convert json object to xml object
data = {
"id": "124324",
"name": "testname",
"email": "testname@gmail.com",
"password": "test1234"
}
def get_json_to_xml_data(data):
return f'''
<?xml version="1.0"?>
<COMMAND>
<ID>{requested_data['id']}</ID>
<NAME>{requested_data['name']}</NAME>
<EMAIL>{requested_data['email']}</EMAIL>
<PASSWORD>{requested_data['password']}</PASSWORD>
</COMMAND>
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment