Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Take a file with JSON as input and produce the equivalent XML in python 2.7 this

ID: 3793326 • Letter: T

Question

Take a file with JSON as input and produce the equivalent XML in python 2.7

this is the json file sample:

sample.json

i want to write a code to conver it to xml

{ "records": [ { "patient": { "dob": "9/1/75", "firstName": "Jonathan", "icd9_1": "414.01", "icd9_2": "508.2", "lastName": "Beyers", "mrn": "1111" } }, { "patient": { "dob": "8/5/70", "firstName": "Melissa", "icd9_1": "508.0", "icd9_2": "485", "lastName": "Johnston", "mrn": "2222" } }, { "patient": { "dob": "", "firstName": "Melissa", "icd9_1": "508.0", "icd9_2": "485", "lastName": "Johnston", "mrn": "3333" } } ] }

Explanation / Answer

<?xml version="1.0" encoding="UTF-8"?>
<root>
<records>
<element>
<patient>
<dob>9/1/75</dob>
<firstName>Jonathan</firstName>
<icd9_1>414.01</icd9_1>
<icd9_2>508.2</icd9_2>
<lastName>Beyers</lastName>
<mrn>1111</mrn>
</patient>
</element>
<element>
<patient>
<dob>8/5/70</dob>
<firstName>Melissa</firstName>
<icd9_1>508.0</icd9_1>
<icd9_2>485</icd9_2>
<lastName>Johnston</lastName>
<mrn>2222</mrn>
</patient>
</element>
<element>
<patient>
<dob />
<firstName>Melissa</firstName>
<icd9_1>508.0</icd9_1>
<icd9_2>485</icd9_2>
<lastName>Johnston</lastName>
<mrn>3333</mrn>
</patient>
</element>
</records>
</root>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote