asp web api json 序列化后 把私有字段信息也返回了解决办法

 serialization returns private properties

Are your types marked as [Serializable]? Serializable means that the serializer should serialize all fields - private or public.

Try to remove Serializable or else use this line to stop the JSON formatter from recognizing the attribute:

config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new DefaultContractResolver();
 
原文地址:https://www.cnblogs.com/micro-chen/p/6830817.html