I have created class for multi level menu. It works good. But now I want Menu class to convert to JSON object for using in angularjs.
I have class two class
class Menu
{
private List<Item> Items = new List<Item>();
}
class Item
{
public int Id { get; set; }
public int Level { get; set; }
public string Title { get; set; }
public string NavigateUrl { get; set; }
public Menu Child { get; set; }
}`
I need to create JSON object of Menu where Menu class contain List of Item and Item class contain Menu.
JavaScriptSerializer.Serialize work with only one level. Do I have to implement any kind of interface or change the class where serialization is possible?