I have a json string inside a multi value xml tag, which I'm struggling to access. I would like to concatenate the "pid" values to have something like
"listOfPids" : "0000444, 0000111"
<xml>
<custom-attributes>
<custom-attribute attribute-id="status">
<value>{
"order":"000123"
}
</value>
<value>{
"prodId": "01010101",
"status": [
{
"package": "1234",
"products": [
{
"pid": "0000444",
"amount": "2"
}
]
},
{
"package": "6789",
"products": [
{
"pid": "0000111",
"amount": "5"
}
]
}
]
}
</value>
</custom-attribute>
</custom-attributes>
</xml>
I to get at least the first value and tried read and flatten, but didn't get it to work...
listOfPids: read(flatten((payload.xml."custom-attributes".*"custom-attribute") filter ($.@"attribute-id" == "status"))[1].value default "", "application/json").status[0].products[0].pid