I am new new to JSON. I have Input JSON which includes two arrays. 1st one (main results) contains two vendor and other one (BankDetailSet ->results) has vendor bank details (Key and Account ).i-e vendor can have multiple accounts. In put each vendor has two accounts. I am trying with Jolt, in output, I am able to get Vendor info and bank (bsb and account_number). The issue is corresponding vendor bank (bsb and account_number ) have been populated with wrong details.
In Input 1st vendor has
while second one hasIn Out Put 1st vendor has (9877988787 &
while second one has (89797879798 &
The question is why Bankey values have been interchanged in output (bsb). I have pasted below the current and expected output
The is :
{
"d": {
"results": [
{
"__metadata": {
"type": "Core vendor.Vendor"
},
"VendorNumber": "7779898",
"VendorName": "Chigo PvtLimited",
"BankDetailSet": {
"results": [
{
"__metadata": {
"type": "UFCDR Pvt Limited"
},
"BankKey": "9877988787",
"BankAccount": "987788798778879"
},
{
"__metadata": {
"type": "UFCDR Pvt Limited"
},
"BankKey": "89797879798",
"BankAccount": "564654456456465"
}
]
}
},
{
"__metadata": {
"type": "Alpha vendor.Vendor"
},
"VendorNumber": "987545",
"VendorName": "UFCDD Pvt Limited",
"BankDetailSet": {
"results": [
{
"__metadata": {
"type": "UFCDD.BankDetail"
},
"BankKey": "652588887",
"BankAccount": "66887454"
},
{
"__metadata": {
"type": "UFCDR Pvt Limited"
},
"BankKey": "294454545",
"BankAccount": "4578777"
}
]
}
}
]
}
}
the I've tried :
[
{
"operation": "shift",
"spec": {
"d": {
"results": {
"*": {
"VendorNumber": "vendors.[&1].name",
"VendorName": "vendors.[&1].VendorName",
"BankDetailSet": {
"results": {
"*": {
"BankKey": "vendors[&1].Bank[&4].bsb",
"BankAccount": "vendors[&1].Bank[&4].account_number"
}
}
}
}
}
}
}
}
]
The
{
"vendors": [{
"name": "7779898",
"VendorName": "Chigo PvtLimited",
"Bank": [{
"bsb": "9877988787",
"account_number": "987788798778879"
}, {
"bsb": "652588887",
"account_number": "66887454"
}]
}, {
"Bank": [{
"bsb": "89797879798",
"account_number": "564654456456465"
}, {
"bsb": "294454545",
"account_number": "4578777"
}],
"name": "987545",
"VendorName": "UFCDD Pvt Limited"
}]
}
and the
{
"vendors": [
{
"name": "7779898",
"VendorName": "Chigo PvtLimited",
"Bank": [
{
"bsb": "9877988787",
"account_number": "987788798778879"
},
{
"bsb": "89797879798",
"account_number": "564654456456465"
}
]
},
{
"name": "987545",
"VendorName": "UFCDD Pvt Limited",
"Bank": [
{
"bsb": "652588887",
"account_number": "66887454"
},
{
"bsb": "294454545",
"account_number": "4578777"
}
]
}
]
}
