how to transform xml to json in dataweave

This is my payload before transformation:

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

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:


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

Read more here: Source link