Friday, 11 November 2016

Deserialize json to anonymous C# object

I need to deserialize custom JSON to anonymous C# object.



My sample JSON (can be any, even with nested properties as objects):



var json = "{ 'Surname': 'Wick'}"; 


And I want to be deserialized as:



var jsonResult = new { Surname = "Wick" };



But I end up with something like this:



enter image description here

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...