I have started using Json.net recently and changing the existing deserializer from JavaScript to Json.Net
While doing so, I have stuck into one implementation issue.
I have below Json:
string json = @"'Album':{
'Name': 'Classical',
'Date': '2005-4-7T00:00:00'
}";
When I am deSerializing it using Json.net, I am getting a null response:
var a = JsonConvert.DeserializeObject<Album>(json);
I look for help and found that to deserialize it, I need to create a wrapper class to which Album must be a property.
However, I have many such classes to deserialize it. Is there any generic way to do it? Do I need to create wrapper for all my classes like this:
public class JsonOutputWrapper
{
public Album Album{ get; set; }
}
Can I make this work with some generic implementation without creating wrapper class:
var a = JsonConvert.DeserializeObject<Album>(json);