How to Return JSON for Episerver Form by Sort Order

  • Updated

This article illustrates the code to return the JSON for an Episerver Form by a specified sort order.

The code below can be found in full here.
var formIden = new FormIdentity(formGuid, (content as ILocalizable).Language.Name);
var friendlyNames = _formRepository.Service.GetDataFriendlyNameInfos(formIden)
                      .Where(fn => !fn.ElementId.StartsWith(EPiServer.Forms.Constants.SYSTEMCOLUMN_PREFIX))
                      .OrderBy(fn => fn.FriendlyName);
return Json(friendlyNames, JsonRequestBehavior.AllowGet);