public class StagingModel
{
public string? TableName { get; set; }
public string? ConnectionName { get; set; }
public long? TimeStamp { get; set; }
public Dictionary<string, object>? Data { get; set; } = [];
}
StagingModel stagingModel = JsonSerializer.Deserialize<StagingModel>(message);
Here is JSON String for reproduction:
{“TableName”:”position”,”ConnectionName”:”TestDat”,”Timestamp”:1708538002240,”Data”:{“gpslatitude”:54.719564167,”gpslongitude”:11.448629},”TopicName”:”kafka”}
Above is my model which is deserialize into StagingModel, “System.Text.Json.JsonSerializer.Deserialize” is deserialized “TimeStamp” property and the value is null.
At the same time “Newtonsoft.Json.JsonConvert.DeserializeObject” is deserialized the same string and the value of “TimeStamp property” is not null.