Categories
Mastering Development

Groovy – Merge/Group By List of Maps

I have a list of maps that follows the structure List<Map<String,List<String>>> List<Map<String,List<String>>> lstData = [] lstData << ["Year":["FY19"],"Period":["Oct"],"Account":["A1000","A1001"]] lstData << ["Year":["FY19"],"Period":["Oct"],"Account":["A1001","A1002"]] lstData << ["Year":["FY19"],"Period":["Nov"],"Account":["A1000","A1001","A1002"]] lstData << ["Year":["FY19"],"Period":["Dec"],"Account":["A1000","A1002"]] lstData << ["Year":["FY20"],"Period":["Jan"],"Account":["A1000","A1003"]] I have been trying to build something that would output a list in a similar structure as the input, but merged: List<Map<String,List<String>>> lstTarget = [] […]

Categories
Mastering Development

Structure the data from List of dictionary

[{ “caseId”: “A1001”, “caseNames”: [{ “caseName”: “SomeName” }, { “caseName”: “2NDNAME” }, { “caseName”: “3RDNAME” } ], “case”: [{ “caseType”: “SIMPLE”, “additionalValue”: “string”, “additionalInfo”: “string”, “additionalInfoUri”: “string” }] }, { “caseId”: “A1002”, “caseNames”: [{ “caseName”: “SomeName”, “additionalInformation”: “Unlimited dates” }, { “caseName”: “2NDNAME”, “additionalValue”: “2”, “additionalInformation”: “Two free dates” }, { “caseName”: “3RDNAME” }, { […]