Is there any way to serialize collection of objects to json object properties? I would like to use newtonsoft json.
Let's suppouse I have:
class Item
{
public string Name { get; set; }
public string Prop1 { get; set; }
}
var items = new List<Item>
{
new Item { Name = "a", Prop1 = "123" },
new Item { Name = "b", Prop1 = "456" },
new Item { Name = "c", Prop1 = "789" }
}
After serialization I would like to have:
{
'a' : { 'prop1': '123' }
'b' : { 'prop1': '345' }
'c' : { 'prop1': '789' }
}
Thanks for any help IT Man