I'm working with a REST Api at the moment which I have no control over and have built models to correspond with the json which I receive from the Api.
The Api in question though doesn't allow me to push the whole model back when doing a post so I need to find a way to Deserialize the json in full but only write selected data when Serializing.
So far I have tried JsonIgnore which does what it says on the tin and completely ignores the property.
I then created a Custom Attribute JsonWriteAttribute and applied it to the properties I want to serialise.
I've looked at overriding the DefaultContractResolver CreateProperties method to then only get properties with the attribute but I cant seem to determine from the method or a property in the Resolver if I'm doing a read or write.
I've also tried looking at a custom JsonConverter but it seems like from that I cant interrupt a pipeline and have to then handle all the write myself. Am I missing something here as it seems like the right idea?
Anyone figured out a way to mark a property as ReadOnly when doing serialisation, deserialization using Json.Net?
Thanks