I have a problem with my Jolt transformation but no idea how to fix it. The value is added to the wrong array element and not to the one it belongs to.
That's my JSON :
{
"Verkaufsprodukt": [
{
"Produkt": [
{
"Kurzbeschreibung": "A"
},
{
"Kurzbeschreibung": "B",
"Kondition": [
{
"Bezeichnung": "something"
}
]
}
]
}
]
}
This is the spec:
[
{
"operation": "shift",
"spec": {
"Verkaufsprodukt": {
"*": {
"Produkt": {
"*": {
"Kurzbeschreibung": "vertragsdetails.deckungen[].bezeichnung",
"Kondition": {
"*": {
"Bezeichnung": "vertragsdetails.deckungen[&1].kondition"
}
}
}
}
}
}
}
},
{
"operation": "cardinality",
"spec": {
"vertragsdetails": {
"deckungen": "MANY"
}
}
}
]
I am expecting this:
{
"vertragsdetails": {
"deckungen": [
{
"bezeichnung": "A"
},
{
"bezeichnung": "B",
"kondition": "something"
}
]
}
}
but got this:
{
"vertragsdetails": {
"deckungen": [
{
"bezeichnung": "A",
"kondition": "something"
},
{
"bezeichnung": "B"
}
]
}
}
Why is the "kondition" adding to the first element and not to the second where it belongs to? can someone help please? Thanks!