I have input JSON as
{
"eventTime" : "2024-01-17T15:10:06.858",
"groupArticleNumber" : "FT6559",
"groupModelNumber" : "FRX88",
"productDescriptionEN" : "ESTRO 19 JSYY",
"subBrand" : "1",
"brand" : "11",
"businessSegment" : "104",
"salesLine" : "L84",
"materialComposition" : [ "100% PET-REC", "100% PET-DAT" ],
"mainMaterialFlag" : [ true, false ],
"productDescEN" : "ESTRO 19 JSYY",
"colorwayShortDescEN" : "TMLGBL/WHITE",
"keyCategory" : "00095",
"ageGroup" : "J",
"gender" : "M",
"genderAge" : "16",
"genderAgeMain" : "Kids",
"articleLifeCycle" : "50",
"sizePage" : "J4",
"articleCreationSeason" : "20201",
"articleActiveSeason" : "20242",
"rmhProductDivision" : "2",
"rmhProductType" : "30",
"rmhCategory" : "09",
"retailClass" : "12309",
"retailSubClass" : "1230930",
"retailDepartment" : "12",
"retailSubDepartment" : "123",
"sourcingSizeCode3" : [ "190", "180" ]
}
and i want output like
[
{
"eventTime": "2024-01-17T15:10:06.858",
"groupArticleNumber": "GI7343",
"sourcingSizeCode3": "190",
"productDescEN": "A.RDY UPF LS P",
"colorwayShortDescEN": "NHLSJS/WHTMEL/BLACK",
"keyCategory": "00056",
"groupModelNumber": "FRX88",
"productDescriptionEN": "ESTRO 19 JSYY",
"retailClass": "12309",
"retailSubClass": "1230930",
"retailDepartment": "12",
"retailSubDepartment": "123",
"rmhProductDivision": "2",
"subBrand": "1",
"brand": "11",
"rmhCategory": "09",
"businessSegment": "104",
"ageGroup": "J",
"gender": "M",
"genderAge": "16",
"genderAgeMain": "Kids",
"articleLifeCycle": "50",
"sizePage": "J4",
"materialComposition": "100% PET-REC",
"mainMaterialFlag": true,
"articleCreationSeason": "20201",
"articleActiveSeason": "20242",
"salesLine": "L84",
"rmhProductType": "30"
},
{
"eventTime": "2024-01-17T15:10:06.858",
"groupArticleNumber": "GI7343",
"sourcingSizeCode3": "180",
"productDescEN": "A.RDY UPF LS P",
"colorwayShortDescEN": "NHLSJS/WHTMEL/BLACK",
"keyCategory": "00056",
"groupModelNumber": "FRX88",
"productDescriptionEN": "ESTRO 19 JSYY",
"retailClass": "12309",
"retailSubClass": "1230930",
"retailDepartment": "12",
"retailSubDepartment": "123",
"rmhProductDivision": "2",
"subBrand": "1",
"brand": "11",
"rmhCategory": "09",
"businessSegment": "104",
"ageGroup": "J",
"gender": "M",
"genderAge": "16",
"genderAgeMain": "Kids",
"articleLifeCycle": "50",
"sizePage": "J4",
"materialComposition": "100% PET-REC",
"mainMaterialFlag": true,
"articleCreationSeason": "20201",
"articleActiveSeason": "20242",
"salesLine": "L84",
"rmhProductType": "30"
},
{
"eventTime": "2024-01-17T15:10:06.858",
"groupArticleNumber": "GI7343",
"sourcingSizeCode3": "190",
"productDescEN": "A.RDY UPF LS P",
"colorwayShortDescEN": "NHLSJS/WHTMEL/BLACK",
"keyCategory": "00056",
"groupModelNumber": "FRX88",
"productDescriptionEN": "ESTRO 19 JSYY",
"retailClass": "12309",
"retailSubClass": "1230930",
"retailDepartment": "12",
"retailSubDepartment": "123",
"rmhProductDivision": "2",
"subBrand": "1",
"brand": "11",
"rmhCategory": "09",
"businessSegment": "104",
"ageGroup": "J",
"gender": "M",
"genderAge": "16",
"genderAgeMain": "Kids",
"articleLifeCycle": "50",
"sizePage": "J4",
"materialComposition": "100% PET-DAT",
"mainMaterialFlag": false,
"articleCreationSeason": "20201",
"articleActiveSeason": "20242",
"salesLine": "L84",
"rmhProductType": "30"
},
{
"eventTime": "2024-01-17T15:10:06.858",
"groupArticleNumber": "GI7343",
"sourcingSizeCode3": "180",
"productDescEN": "A.RDY UPF LS P",
"colorwayShortDescEN": "NHLSJS/WHTMEL/BLACK",
"keyCategory": "00056",
"groupModelNumber": "FRX88",
"productDescriptionEN": "ESTRO 19 JSYY",
"retailClass": "12309",
"retailSubClass": "1230930",
"retailDepartment": "12",
"retailSubDepartment": "123",
"rmhProductDivision": "2",
"subBrand": "1",
"brand": "11",
"rmhCategory": "09",
"businessSegment": "104",
"ageGroup": "J",
"gender": "M",
"genderAge": "16",
"genderAgeMain": "Kids",
"articleLifeCycle": "50",
"sizePage": "J4",
"materialComposition": "100% PET-DAT",
"mainMaterialFlag": false,
"articleCreationSeason": "20201",
"articleActiveSeason": "20242",
"salesLine": "L84",
"rmhProductType": "30"
}
]
need jolt spec for same
i tried this spec
[
{
"operation": "shift",
"spec": {
"value": {
"metadata": {
"eventTime": "eventTime"
},
"payload": {
"productPrimaryData": {
"key": {
"groupArticleNumber": "groupArticleNumber",
"groupModelNumber": "groupModelNumber"
},
"model": {
"productDescriptionEN": "productDescriptionEN",
"subBrand": "subBrand",
"brand": "brand",
"businessSegment": "businessSegment"
},
"modelSeason": {
"salesLine": "salesLine"
},
"articleSeason": {
"articleMainMaterial": {
"*": {
"materialComposition": "materialComposition",
"mainMaterialFlag": "mainMaterialFlag"
}
}
},
"article": {
"productDescEN": "productDescEN",
"colorwayShortDescEN": "colorwayShortDescEN",
"keyCategory": "keyCategory",
"ageGroup": "ageGroup",
"gender": "gender",
"genderAge": "genderAge",
"genderAgeMain": "genderAgeMain",
"articleLifeCycle": "articleLifeCycle",
"sizePage": "sizePage",
"articleCreationSeason": "articleCreationSeason",
"articleActiveSeason": "articleActiveSeason",
"rmh": {
"*": {
"rmhProductDivision": "rmhProductDivision",
"rmhProductType": "rmhProductType",
"rmhCategory": "rmhCategory",
"retailClass": "retailClass",
"retailSubClass": "retailSubClass",
"retailDepartment": "retailDepartment",
"retailSubDepartment": "retailSubDepartment"
}
},
"articleSize": {
"*": {
"sourcingSizeCode3": "sourcingSizeCode3"
}
}
}
}
}
}
}
}
]
but not working
You can use the following shift transformation specs :
[
{ // group by two types of arrays and objects
"operation": "shift",
"spec": {
"*": "Others.&",
"*ateria*": {
"*": {
"@": "x[&1].&2"
}
},
"sourcingSizeCode3": {
"*": {
"@": "y[&1].&2"
}
}
}
},
{ // multiplex the arrays "x" vs. "y" through use of @1 representation
"operation": "shift",
"spec": {
"Others": "&",
"*": {
"*": {
"@1": "&2&1"
}
}
}
},
{
"operation": "shift",
"spec": {
"Others": "&",
"x*": {
"*": {
"*": "&1_&(2,1).&"
}
},
"y*": {
"*": {
"*": "&(2,1)_&1.&" // the reversely tiled with respect to the upper identifiers
// nested within "x*" object representation
}
}
}
},
{ // separate "Others" object vs. array
"operation": "shift",
"spec": {
"Others": "&",
"*": "arr"
}
},
{
"operation": "shift",
"spec": {
"arr": {
"*": {
"@2,Others": { "*": "[&1].&" }, // go two levels up the tree to grab the values from the "arr" array
"*": "[&1].&"
}
}
}
}
]