I've used the built-in Visual Studio menu option "Paste Special->Paste JSON as classes" selection on a JSON string that contains dots in the names of fields. (Example: System.Title).
The generated class has the dots removed (understandably) from the property names in the class (From the above example, System.Title = SystemTitle). Here is a snippet of an example of the JSON that I am trying to deserialize (from Microsoft TFS REST APIs):
{
"id": 27736,
"rev": 6,
"fields": {
"System.WorkItemType": "Test Case",
"System.State": "Ready",
"System.Reason": "Completed",
"System.Title": "EFCValuesTest_DenomNotPresent",
"Microsoft.VSTS.Common.StateChangeDate": "2019-02-14T21:15:37.627Z",
"Microsoft.VSTS.Common.ActivatedDate": "2019-01-25T20:25:52.743Z",
"Microsoft.VSTS.Common.Priority": 4,
},
},
Notice that although CamelCase is used, there are also dot (.) name separators as well.
When I try to deserialize the fields JSON segment into the class object, the values are not extracted. However, if I place a JsonProperty attribute with the PropertyName set to the name with dots such as [JsonProperty(PropertyName = "System.Title")], then Json.NET can resolve the name and assign the correct value upon deserialization.
Is there any way to have Json.NET do this name-lookup conversion automatically without having to assign the JsonProperty to all of the class properties that are associated with fields that have dots in the name?