In groovy I have the below xml
<data>
<row>
<id>USA</id>
<value>United States of America</value>
</row>
<row>
<id>CAN</id>
<value>Canada</value>
</row>
</data>
I need to transform the above xml in groovy to the below json format
{
"data": [
{
"KEY": "USA",
"VALUE": "United States of America"
},
{
"KEY": "CAN",
"VALUE": "Canada"
}
]
}
Any help would be greatly appreciated.
Thanks
Hari