From what you said in the comment, it sounds like you have data in some format, and you want to convert that data into an XML syntax string. Assuming that the data is in a dictionary (based on the code you posted where you get the json), you probably want to use the xml.etree.Elementree
package. @MrAZ's answer reads the data, but the documentation also provides a means to write data to a string.
Alternatively, there are third-party packages (not included with Python) which convert json or dict into xml (for example, https://pypi.org/project/dicttoxml/ and https://pypi.org/project/json2xml/ , which can be installed with pip)