I'm new to JOLT, I'm facing some issue in getting the proper JSON after the jolt sepc transformation. Below are the given json, used Jolt Spec and expected output. But when I process the Jolt Spec I'm not getting ReportedQtyUom and ReportedQty data in the JSON output. Please anyone let me know where I'm going wrong. Thank You
Given JSON
[
{
"MaterialId": "na-103437",
"LocationId": "0TB9",
"OHReportingDate": "2020-08-18T20:57:16Z",
"TankNumber": "KTLA",
"stocks": [
{
"stockStatus": "OnHand",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
},
{
"stockStatus": "Damaged",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
},
{
"stockStatus": "QualityInspection",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
}
]
},
{
"MaterialId": "na-103437",
"LocationId": "0TB9",
"OHReportingDate": "2020-08-18T20:57:16Z",
"TankNumber": "KTLJ",
"stocks": [
{
"stockStatus": "OnHand",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
},
{
"stockStatus": "Damaged",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
},
{
"stockStatus": "QualityInspection",
"quantity": [
{
"uom": "KG",
"amount": "0.000",
"ISOUom": "KGM"
}
]
}
]
}
]
JOLT Spec Used
[
{
// Keeping the same three nested arrays structure,
// build all the output "elements" into a parallel
// structure, creating a "header" object and an
// array of attachment objects.
"operation": "shift",
"spec": {
"*": {
"MaterialId": "[&1].MaterialId",
"LocationId": "[&1].LocationId",
"OHReportingDate": "[&1].OHReportingDate",
"TankNumber": "[&1].TankNumber",
"stocks": {
"*": {
"stockStatus": {
"OnHand": {
"quantity": {
"*": {
"@(0,uom)": "[&7].POI",
"@(0,amount)": "[&7].XYZ"
}
}
}
}
}
}
}
}
}
]
Expected
[ {
"MaterialId" : "na-103437",
"LocationId" : "0TB9",
"OHReportingDate" : "2020-08-18T20:57:16Z",
"TankNumber" : "KTLA",
"ReportedQtyUom" : "KG",
"ReportedQty": "0.000"
}, {
"MaterialId" : "na-103437",
"LocationId" : "0TB9",
"OHReportingDate" : "2020-08-18T20:57:16Z",
"TankNumber" : "KTLJ",
"ReportedQtyUom" : "KG",
"ReportedQty" : "0.000"
}]
"quantity": {"*": {"@(0,uom)": "[&7].ReportedQtyUom","@(0,amount)": "[&7].ReportedQty"}}- Giridhar Mg