Let's say I have a list:
var list = new List<int>{1,2,3};
How do I add this to an anonymous object such that the object would look like:
{ list : [1,2,3] }
By creating the anonymous object:
var anon = new { list }
I assume that by saying you want it to look like this:
{ list : [1,2,3] }
you are talking about the output of a JSON serialization, in which it would look like once you serialize.