I have a (simplified) object like so:
public class Contact
{
[Ignore]
public string Name { get; set;}
}
and I serialize and deserialise the object to create a deep copy clone (https://stackoverflow.com/a/78612/2987066) like so:
var deserializeSettings = new JsonSerializerSettings
{
ObjectCreationHandling = ObjectCreationHandling.Replace,
};
var clone = JsonConvert.SerializeObject(contact, deserializeSettings);
return JsonConvert.DeserializeObject<T>(clone);
but the property does not get copied across
Is it possible to serialise properties marked as [Ignore]
. Maybe using JsonSerializerSettings
or do I need to mark it as [JSONProperty]