Can JavaScriptSerializer exclude properties with null/default values?

前端 未结 7 1033
野趣味
野趣味 2020-12-01 05:08

I\'m using JavaScriptSerializer to serialize some entity objects.

The problem is, many of the public properties contain null or default values. Is there any way to m

相关标签:
7条回答
  • 2020-12-01 06:06

    Without changing toe DataContractSerializer

    You can use ScriptIgnoreAttribute

    [1] http://msdn.microsoft.com/en-us/library/system.web.script.serialization.scriptignoreattribute.aspx

    0 讨论(0)
提交回复
热议问题