Hello, I'm having trouble deserializing a Json, I'm not getting the right data.
There is the Main Class that would receive the data list
public class PermissaoDossie
{
[JsonProperty(PropertyName = "data")]
public string data { get; set; }
[JsonProperty(PropertyName = "listPermissoes")]
public string listPermissoes { get; set; }
[JsonProperty(PropertyName = "dadosPermissao")]
public string dadosPermissao { get; set; }
[JsonProperty(PropertyName = "name")]
public string name { get; set; }
[JsonProperty(PropertyName = "value")]
public string value { get; set; }
}
And the List Class
public class RootObject
{
public List<PermissaoDossie> dossie { get; set; }
}
Here is Json and the process
String JsonString = {"data":{"listPermissoes":[{"dadosPermissao":[{"name":"usuario","value":"ADMINISTRADOR"},{"name":"codigo_usuario","value":"1"},
{"name":"unidade","value":"Unidade qualquer"},{"name":"codigo_unidade","value":"001"},
{"name":"nivel","value":"R"}]},
{"dadosPermissao":[{"name":"usuario","value":"Usuario qualquer"},{"name":"codigo_usuario","value":"23945"},{"name":"unidade","value":"Administração"},{"name":"codigo_unidade","value":"1302"},
{"name":"nivel","value":"M"}]}]},"service":{"name":"ConsultaPermissao"},"message":{"type":"success","value":""}}
//////// Here's the wrong Deserialization
var result = JsonConvert.DeserializeObject<IDictionary<string, RootObject>>(JsonString);
This is the result, but I want the value inside the name and value