using System.Collections.Generic;
public string Currency {get; set;}
public int PaymentAmount {get; set;}
public string AssignmentId {get; set;}
public string Code {get;set;}
public static void Main()
new PC{Currency = "EUR", PaymentAmount = 5, AssignmentId = "A41", Code = "A"},
new PC{Currency = "EUR", PaymentAmount = 1, AssignmentId = "A41", Code = "B"},
new PC{Currency = "GBP", PaymentAmount = 2, AssignmentId = "A41", Code = "C"},
new PC{Currency = "GBP", PaymentAmount = 5, AssignmentId = "A41", Code = "D"},
new PC{Currency = "RUB", PaymentAmount = 9, AssignmentId = "A41", Code = "E"},
new PC{Currency = "RUB", PaymentAmount = 11, AssignmentId = "A42", Code = "F"},
var aggregated= PCs.GroupBy(pc => pc.AssignmentId).Select(g=> new Dictionary<string, List<PC>>{{g.Key, g.ToList()}});
Console.WriteLine(JsonConvert.SerializeObject(aggregated));