public JsonResult Catalog(string filter, string language) { if (String.IsNullOrEmpty(filter)) { var query = ReaderManager.Instance.GetCatalog(true, null, String.IsNullOrEmpty(language) ? null : language); var tree = TreeService.GetNavigationTreeModel(query, c => c.Name, c => c.PublishedCount, c => c.Id); string str = Newtonsoft.Json.JsonConvert.SerializeObject(tree); str = str.Replace("\"data\":", "\"title\":"); List <DynaTreeModel> lstTree = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DynaTreeModel> >(str); return(Json(lstTree, JsonRequestBehavior.AllowGet)); } var filterQuery = ReaderManager.Instance.GetCatalog(false, filter, language); var flat = filterQuery.ToList() .Select(c => new DynaTreeModel { title = c.Name, attr = new JsTreeAttribute { id = c.Id.ToString(CultureInfo.InvariantCulture), rel = "file" }, children = null }); return(Json(flat, JsonRequestBehavior.AllowGet)); }