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
def json2xml(json_obj, tag_name=None): | |
result_list = list() | |
json_obj_type = type(json_obj) | |
if json_obj_type is list: | |
for sub_elem in json_obj: | |
result_list.append("\n<%s>" % (tag_name)) | |
result_list.append(json2xml(sub_elem, tag_name=tag_name)) | |
tag_name = re.sub('\s\w+="\w+"', '', tag_name) |