Group List of Objects based on Property using Linq?
It sounds like you want something like: // No need to sort sites first var grouped = sites.OrderBy(x => x.Type) .GroupBy(x => x.Type); Then just serialize grouped. However, I don’t know quite what an IGrouping will look like in JSON… and the type will be present in each case. You may want something like: var … Read more