I have the JSON string:
{"response":{"token":"{\"token\":\"123\",\"id\":191}"}}
And then I have the following code to Deserialize it, but it is returning null:
var def = new
{
token = new { token = string.Empty, id= string.Empty }
};
var deserializedToken = JsonConvert.DeserializeAnonymousType(token, def);
deserializedToken
is null
Here is a more detailed example that I can't get to work:
var def = new
{
code = string.Empty,
message = string.Empty,
url= string.Empty,
token = new {token = string.Empty}
};
var response = JsonConvert.DeserializeAnonymousType(data, def);
var innerDef = new { token= string.Empty, id= string.Empty };
var deserializedInner = JsonConvert.DeserializeAnonymousType(response.token.token, innerDef);