I need to remove duplicates from the below JSon, if there are duplicates in the closed Array, only one value should be retained.
In the below example, the Closed Array contains PP21 two times, i want only once. like [ “PP21”]
Input
[ {
"name" : "SAndOP-ProductionPlanningTable",
"dataIO" : {
"data" : [ {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
} ],
"Closed" : [ "PP21", "PP21" ]
}
}, {
"name" : "SAndOP-ProductionPlanningTable2",
"dataIO" : {
"data" : [ {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
} ],
"Closed" : [ "PP22", "PP23" ]
}
} ]
Output Expected
[ {
"name" : "SAndOP-ProductionPlanningTable",
"dataIO" : {
"data" : [ {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
} ],
"Closed" : [ "PP21" ]
}
}, {
"name" : "SAndOP-ProductionPlanningTable2",
"dataIO" : {
"data" : [ {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
}, {
"plant" : "1000",
"material" : "000002074099700010",
"qty" : 15
} ],
"Closed" : [ "PP22", "PP23" ]
}
} ]
I have looked at examples and didn’t get any closer as to what is mentioned above. I need to transform a JSON structure by using a JOLT spec. I use https://jolt-demo.appspot.com to test the following below.
Can someone please suggest how I can get this to work. Thanks in advance