Omit <item>...</item> from arrays
jgroom33 opened this issue · 0 comments
jgroom33 commented
Assume the following json:
{"my_items":[{"my_item":{"id":1} },{"my_item":{"id":2} }]}
Current behavior:
<all>
<my_items type="list">
<item>
<my_item>
<id type="int">1</id>
</my_item>
</item>
<item>
<my_item>
<id type="int">2</id>
</my_item>
</item>
</list>
</all>
Desired behavior:
Add attribute item_wrap
as Boolean
data = readfromstring(
'{"my_items":[{"my_item":{"id":1} },{"my_item":{"id":2} }]}'
)
print(json2xml.Json2xml(data, item_wrap=False).to_xml())
<all>
<my_items type="list">
<my_item>
<id type="int">1</id>
</my_item>
<my_item>
<id type="int">2</id>
</my_item>
</list>
</all>