public string GetJSON() { XJsonWriter writer = new XJsonWriter(); writer.WriteNameValue("label", _label); writer.WriteNameValue("value", _value); writer.WriteNameValue("isSelectable", _isSelectable); writer.WriteNameValue("cssClass", _cssClass, true); return(writer.ToString()); }
public static void WriteMenuItemsToJSON(List <AutoSuggestMenuItem> menuItems, int totalResults, XJsonWriter writer) { List <string> jsonMenuItems = new List <string>(); string jsonMenuItem; foreach (AutoSuggestMenuItem menuItem in menuItems) { jsonMenuItem = menuItem.GetJSON(); jsonMenuItems.Add(jsonMenuItem); } writer.WriteList("menuItems", jsonMenuItems, false); //Add total results writer.WriteNameValue("totalResults", totalResults, true); }