I have a context menu which has menu items and sub menu items. A menu can have zero or more sub menu items.I need to map my menu object to a json object as follows. How can I do it?
var commonMenuItems = [
{
Menu: "Print",
Caption: "Print"
},
SubMenuItems: [
{
SubMenuItemName: "PrintSelected",
SubMenuItemDisplayName: "Print Selected",
},
{
SubMenuItemName: "PrintAll",
SubMenuItemDisplayName: "Print All",
}
]
}
];
I want to map commonMenuItems array to items json object items programatically.
items: {
"Print": {"name": "Print"
"items":{
"PrintSelected": {"name": "Print Selected"},
"PrintAll": {"name": "Print All"},
}
}