how to transform xml to json in dataweave

This is my payload before transformation:

<?xml version="1.0" encoding="UTF-8" ?>
<response>
    <status_code>0</status_code>
    <goods goods_code="A999">
        <cs cs_code="00100L" color_id="8" size_id="3"/>
        <cs cs_code="00100M" color_id="8" size_id="2"/>        
    </goods>
</response>

i hope got

[
{
  "cs_code": 00100L,
  "color_id": 8,
  "size_id": 3
},
{
  "cs_code": 00100L,
  "color_id": 8,
  "size_id": 2
},
]

This is the dataweave code to transform xml to json:

payload.response.goods

but i got null
{
“cs”: null,
“cs”: null
}

Read more here: Source link