public ActionResult GetItem2(int param1) { var item = SampleModel.CreateSampleWithCultureInfo(); var converter = new ControlledSerializationJsonConverter( supportedTypes: new[] { item.GetType() }, recursionDepth: 10, formatters: new Dictionary <Type, Func <object, string> >() { { typeof(CultureInfo), (o) => ((CultureInfo)o).ToString() } }); var jss = new JavaScriptSerializer(); jss.RegisterConverters(new[] { converter }); var json = jss.Serialize(item); return(this.Content(json, "application/json")); }
public SampleModel Test1(int param1) { var item = SampleModel.CreateSampleWithCultureInfo(); return(item); }
public ActionResult GetItem1(int param1) { var item = SampleModel.CreateSampleWithCultureInfo(); return(Json(item, JsonRequestBehavior.AllowGet)); }