i need to convert a JSON file
{
"Order1/variable1.py": {
"Order1/variable1.py": null,
"Order1/variable2.py": 7,
"Order1/variable3.py": 23,
"Order2/variable4.py": 61,
"Order2/variable5.py": 0,
},
"Order1/variable2.py": {
"Order1/variable1.py": 100,
"Order1/variable2.py": null,
"Order1/variable3.py": 35,
"Order2/variable4.py": 13,
"Order2/variable5.py": 0,
},
"Order1/variable3.py": {
"Order1/variable1.py": 18,
"Order1/variable2.py": 24,
"Order1/variable3.py": null,
"Order2/variable4.py": 0,
"Order2/variable5.py": 0,
},
"Order2/variable4.py": {
"Order1/variable1.py": 6,
"Order1/variable2.py": 72,
"Order1/variable3.py": 39,
"Order2/variable4.py": null,
"Order2/variable5.py": 0,
},
"Order2/variable5.py": {
"Order1/variable1.py": 0,
"Order1/variable2.py": 71,
"Order1/variable3.py": 88,
"Order2/variable4.py": 69,
"Order2/variable5.py": null,
},}
into an XML file that must look like this
<?xml version="1.0" encoding="utf-8"?>
<model elementCount="7" relationCount="20">
<elements>
<element id="2" order="2" name="Order1" type="Order" expanded="True" />
<element id="3" order="3" name="variable1" type="Variable" expanded="False" parent="2" />
<element id="4" order="4" name="variable2" type="Variable" expanded="False" parent="2" />
<element id="5" order="5" name="variable3" type="Variable" expanded="False" parent="2" />
<element id="6" order="6" name="Order2" type="Order" expanded="True" />
<element id="7" order="7" name="variable4" type="Variable" expanded="False" parent="6" />
<element id="8" order="8" name="variable5" type="Variable" expanded="False" parent="6" />
</elements>
<relations>
<relation id="1" from="3" to="4" type="" weight="7" />
<relation id="2" from="3" to="5" type="" weight="23" />
<relation id="3" from="3" to="7" type="" weight="61" />
<relation id="4" from="3" to="8" type="" weight="0" />
<relation id="5" from="4" to="3" type="" weight="100" />
<relation id="6" from="4" to="5" type="" weight="35" />
<relation id="7" from="4" to="7" type="" weight="13" />
<relation id="8" from="4" to="8" type="" weight="0" />
<relation id="9" from="5" to="3" type="" weight="18" />
<relation id="10" from="5" to="4" type="" weight="24" />
<relation id="11" from="5" to="7" type="" weight="0" />
<relation id="12" from="5" to="8" type="" weight="0" />
<relation id="13" from="7" to="3" type="" weight="6" />
<relation id="14" from="7" to="4" type="" weight="72" />
<relation id="15" from="7" to="5" type="" weight="39" />
<relation id="16" from="7" to="8" type="" weight="0" />
<relation id="17" from="8" to="3" type="" weight="0" />
<relation id="18" from="8" to="4" type="" weight="71" />
<relation id="19" from="8" to="5" type="" weight="88" />
<relation id="20" from="8" to="7" type="" weight="69" />
</relations>
</model>
The JSON file will always be in that format since it comes from another tool, but it may contain more elements (Orders or variables) and therefore each variable would have more rows (e.g., the element Order1/variable1.py may contain some more value like "Order3/variable6.py": 25,).
The XML file also must to be in the format from this example, but the "relations" with weight = 0 may be ignored.
Since i am very new to this topic, i have no idea how to convert it and would be very grateful for any advices.
*I must realize it using python