System.Text.Json - Deserialize nested object as string
问题 I'm trying to use the System.Text.Json.JsonSerializer to deserialize the model partially, so one of the properties is read as string that contains the original JSON. public class SomeModel { public int Id { get; set; } public string Name { get; set; } public string Info { get; set; } } The example code var json = @"{ ""Id"": 1, ""Name"": ""Some Name"", ""Info"": { ""Additional"": ""Fields"", ""Are"": ""Inside"" } }"; var model = JsonSerializer.Deserialize<SomeModel>(json); should produce the