Use an anonymous method to do this:
therefore instead
return Json(it);
do
return Json(new {
it.Name,
CreatedAt = it.CreatedAt.ToString("D")
});
this way you explicitly publish (map) a set of attributes on the Internet that guarantees access only to the allowed properties from JSON.
, JSON.NET, . ( , HideAttribute ).
JSON.NET Controller.Json (SmartJson ). , .