Best way to filter domain objects for json output in an ASP.NET MVC application

后端 未结 6 1220
温柔的废话
温柔的废话 2020-12-05 20:59

If I\'m rendering a regular view in asp.net mvc the only domain object properties that show up in my page the ones I specifically write out. For example:

<         


        
6条回答
  •  有刺的猬
    2020-12-05 21:39

    You may use the [ScriptIgnore] attribute (in System.Web.Extensions). See http://www.creave.dk/post/2009/10/07/Excluding-properties-from-being-serialized-in-ASPNET-MVC-JsonResult.aspx for an example.

提交回复
热议问题