Deserialize an Anonymous Type

Deserialize an Anonymous Type

var definition = new { Name = "" };

string json1 = @"{'Name':'Jerry'}";
var customer1 = JsonConvert.DeserializeAnonymousType(json1, definition);

Console.WriteLine(customer1.Name);
// Jerry

string json2 = @"{'Name':'Millan'}";
var customer2 = JsonConvert.DeserializeAnonymousType(json2, definition);

Console.WriteLine(customer2.Name);
// Millan

2020-02-02