transform – Convert XML to JSON with Attributes and Text as Keys Without __text

I have a payload in XML format, and I need to convert it to JSON. The XML contains many key-value pairs and also a lot of attributes, and I need those attributes to be included in the JSON as well.


  

    test  

```

This one output writeAttributes=true makes __text but I dont want have it. 
I want to change this dynamically so that this__text becomes a key. I have more attributes and I can't have everywhere __text

example:

```{

"CustomData": {

"CustomIdentifier": {

"@attribute1": "value1",

"@attribute2": "value2",

"CustomIdentifier": "test"

}

}

}```

Read more here: Source link