publicclassArrayJsonResult:System.Web.Mvc.JsonResult { publicoverridevoidExecuteResult(ControllerContext context) { if(context ==null) { thrownewArgumentNullException("context"); } if(JsonRequestBehavior==JsonRequestBehavior.DenyGet&& String.Equals(context.HttpContext.Request.HttpMethod,"GET",StringComparison.OrdinalIgnoreCase)) { thrownewInvalidOperationException("JsonRequest_GetNotAllowed"); } HttpResponseBase response = context.HttpContext.Response; if(!String.IsNullOrEmpty(ContentType)) { response.ContentType=ContentType; } else { response.ContentType="application/json"; } if(ContentEncoding!=null) { response.ContentEncoding=ContentEncoding; } if(Data!=null) { StringWriter sw =newStringWriter(); sw.Write("["); try { var collection =DataasIEnumerable; int countLessOne = collection.Count()-1; for(int i =0; i < countLessOne; i++) { sw.Write(collection.ElementAt(i)); sw.Write(","); } sw.Write(collection.ElementAt(countLessOne)); } catch(Exception) { //data was not a collection } sw.Write("]"); response.Write(sw.ToString()); } }