I have two components in a distributed system, which send messages which are serialized/deserialized using Newtonsoft.JSON (JSON.Net).
The message properties are currently sent in Norwegian, and I am looking to translate the codebase to English. Since there is a change that some messages would have been sent in Norwegian, and handled by a component which has been upgraded to the English version, it needs to be able to support both.
I would like that on deserialization, both the 'Norwegian' property name as well as English would map to the same property. For example:
For example, take 'name' in English or 'navn' in Norwegian.
public class Message
{
[JsonProperty("Navn")]
public string Name { get; set;}
}
The problem with the above is that it would map only from Navn => Name
. I would like it to map both Navn
and Name
to Name
.
Is this available in Newtonsoft.JSON, without much custom coding?