def rewrite_json(rewrite_type, soup, json_content):
if not soup:<EOL><INDENT>return json_content<EOL><DEDENT>if not elifetools.rawJATS.doi(soup) or not elifetools.rawJATS.journal_id(soup):<EOL><INDENT>return json_content<EOL><DEDENT>journal_id_tag = elifetools.rawJATS.journal_id(soup)<EOL>doi_tag = elifetools.rawJATS.doi(soup)<EOL>journal_id = elifetools.utils.node_text(journal_id_tag)<EOL>doi = elifetools.utils.doi_uri_to_doi(elifetools.utils.node_text(doi_tag))<EOL>if journal_id.lower() == "<STR_LIT>":<EOL><INDENT>function_name = rewrite_function_name(journal_id, rewrite_type)<EOL>if function_name:<EOL><INDENT>try:<EOL><INDENT>json_content = globals()[function_name](json_content, doi)<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>return json_content<EOL>
Due to XML content that will not conform with the strict JSON schema validation rules,
for elife articles only, rewrite the JSON to make it valid