I am using JSON.NET to deserialize and serialize JSON. I would like to ignore some fields but only during serialization and not deserializing, somthing like [JsonIgnoreWhenSerializing]
, does this exist or is there any way to do this?
Asked
Active
Viewed 51 times
2

Loïc Noest
- 125
- 1
- 11
-
1There's no `access` property on `JsonPropertyAttribute`, and the `@` syntax, are you confusing this question for Java? – Lasse V. Karlsen Feb 25 '20 at 08:07
-
2Add a `ShouldSerializePropertyName` method alongside the property, that returns `false`. – Lasse V. Karlsen Feb 25 '20 at 08:07
-
@LasseV.Karlsen you are probably right.maybe [this](https://stackoverflow.com/questions/11564091/making-a-property-deserialize-but-not-serialize-with-json-net) will help him – styx Feb 25 '20 at 08:20
-
Yes, that is better duplicate question. – Lasse V. Karlsen Feb 25 '20 at 08:24