Is it possible to convert JSON to an anonymous object if I don't have a model?
Here's an example with a model:
var json = "{\"firstName\": \"John Doe\", \"lastName\": \"Doe\"}";
var model = new { firstName = "", lastName = "" };
var result = JsonConvert.DeserializeAnonymousType(json, model);
//result: { firstName = John Doe, lastName = Doe }
How to do the same if I don't know the data structure like in the example?
The problem is I'm actually using some library and it doesn't work if I pass a dynamic object as a parameter. The only way the method I need to work is passing an anonymous object like:
instance.SomeMethod(new { firstName = "John", lastName = "Doe" })