All,
I would like to create a new record based on the GroupTypeDescription. The value for this key could be "Individual" or "Enitity". Any help is appreciated
INPUT
{
"ConsolidatedList": [
{
"AliasType": "Primary",
"AliasTypeName": "AKA",
"Country": null,
"CountryOfBirth": "Syria",
"GroupStatus": "Asset Tweaking",
"GroupTypeDescription": "Individual",
"ID": 33233,
"LastUpdated": "2021-03-15T00:00:00",
"LastUpdatedDay": 15,
"name1": "Larry",
"name2": "Dan"
},
{
"AliasType": "AKA",
"AliasTypeName": "AKA",
"Country": null,
"CountryOfBirth": "Afghan",
"GroupStatus": "Asset Freeze Targets",
"GroupTypeDescription": "Entity",
"ID": 33233,
"LastUpdated": "2021-03-15T00:00:00",
"LastUpdatedDay": 15,
"name1": "Luna",
"name2": "Daniel"
}
]
}
EXPECTED OUTPUT
{
"RecordType": ["Entity","Individual"],
"Records": [
{
"_id": "1", // Counter
"RecordType": "Entity",
"Names": [
{
"_id": "1", //counter
"OtherName": "",
"UnparsedName": "",
"FirstName": "Luna",
"LastName": "Daniel",
"AliasType": "Primary"
}
]
},
{
"_id": "2",
"RecordType": "Individual",
"Names": [
{
"_id": "1",
"OtherName": "",
"UnparsedName": "",
"FirstName": "Larry",
"LastName": "Dan",
"AliasType": "AKA"
}
]
}
]
}
SPEC So far
[
{
"operation": "shift",
"spec": {
"ConsolidatedList": {
"*": {
"GroupTypeDescription": "Records[0].RecordsType[&1]",
"# ": "Records[0].Names.[&1].Other Name",
"# ": "Records[0].Names.[&1].UnparsedName",
"AliasType": "Records[0].Names.[&1].NameType"
}
}
}
}
]
I need to split record into objects based on the recordType. Please ignore the first name and last name.