Relative Content

Tag Archive for c#jsonserializerasp.net-core-8

Very strange behavior of System.Text.Json.JsonSerializer.Deserialize

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 […]