I am trying to convert XML to JSON using the XML to JSON policy.
When I have the following XML
<team>
<employee>
<name>Joe</name>
<surname>Bloggs</surname>
</employee>
<employee>
<name>Jane</name>
<surname>Doe</surname>
</employee>
</team>
this converts perfectly to
{
team:{
employee:[
{
name:'Joe',
surname:'Bloggs'
},
{
name:'Jane',
surname:'Doe'
}
]
}
}
when there is only one employee this is converted to an object instead of an array:
<team>
<employee>
<name>Joe</name>
<surname>Bloggs</surname>
</employee>
</team>
converts wrongly to
{
team:{
employee:{
name:'Joe',
surname:'Bloggs'
}
}
}
Hov can I instead get the result
{
team:{
employee:[
{
name:'Joe',
surname:'Bloggs'
}
]
}
}
Thank you so much for your help! ![]()