Created 11-28-2022 07:21 AM
Hi Team,
I have an requirement:
Input:
{
"headers": {
"comments": "3"
},
"data": [
{
"Id": "100000",
"Date": "2022-09-22"
},
{
"Id": "100001",
"Date": "2022-09-02"
}
]
}
Jolt Spec:
[{
"operation": "shift",
"spec": {
"data": {
"*": {
"Id": "[&1].Id",
"Date": "[&1].Date",
"$": "[&1].array_Ind"
}
}
}
}, {
"operation": "modify-default-beta",
"spec": {
"*": {
"Record": "=concat('Record ',@(1,array_Ind))"
}
}
}]
I am getting below output:
[ {
"array_Ind" : "0",
"Id" : "100000",
"Date" : "2022-09-22",
"Record" : "Record 0"
}, {
"array_Ind" : "1",
"Id" : "100001",
"Date" : "2022-09-02",
"Record" : "Record 1"
} ]
Expected output:
[ {
"array_Ind" : "1",
"Id" : "100000",
"Date" : "2022-09-22",
"Record" : "Record 1"
}, {
"array_Ind" : "2",
"Id" : "100001",
"Date" : "2022-09-02",
"Record" : "Record 2"
} ]
Can you please help
Created 11-28-2022 07:47 AM
Hello @Techie123
I added a operation to your Jolt Specification, try it with:
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"Id": "[&1].Id",
"Date": "[&1].Date",
"$": "[&1].array_Ind"
}
}
}
}, {
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"array_Ind": "=intSum(1,@(1,array_Ind))"
}
}
}, {
"operation": "modify-default-beta",
"spec": {
"*": {
"Record": "=concat('Record ',@(1,array_Ind))"
}
}
}
]
Greetings
Created 11-28-2022 07:47 AM
Hello @Techie123
I added a operation to your Jolt Specification, try it with:
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"Id": "[&1].Id",
"Date": "[&1].Date",
"$": "[&1].array_Ind"
}
}
}
}, {
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"array_Ind": "=intSum(1,@(1,array_Ind))"
}
}
}, {
"operation": "modify-default-beta",
"spec": {
"*": {
"Record": "=concat('Record ',@(1,array_Ind))"
}
}
}
]
Greetings
Created 11-28-2022 08:50 PM