I have a problem when dezializing a json that I downloaded from a service.
The structure of the json is as follows:
"{\"d\":{\"tipo\":\"valor\",\"Id\":valor,\"Result\":valor,\"d\":\{\\"Nombre\\":[{\\"idnombre1\\":valor,\\"idnombre2\\":\\"valor\\", \\"idnombre3\\":\\"valor\\", \\"idnombre4\\":\\"valor\\"}]\\"baja\\":valor, \\"baja2\\":[]}\"}}"
I receive this json from a task, and I put it in a string. It looks like this:
string resultadoJson = prueba.Entrar("parametroacceder1","parametroacceder2").Result;
And then I try to deserialize it:
RootObject objClass = JsonConvert.DeserializeObject<RootObject>(resultadoJson);
And I have the following structure
public class Nombre
{
public string idnombre1 { get; set; }
public string idnombre2{ get; set; }
public string idnombre3{ get; set; }
public string idnombre4{ get; set; }
}
public class Datum
{
public List<Nombre> program { get; set; }
}
public class RootObject
{
public int Id { get; set; }
public int result { get; set; }
public List<Datum> d { get; set; }
public string baja { get; set; }
}
When the program is going to deserialize I get an error with the JSON
Can not deserialize the current JSON object because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
Can you give me a hand to know what I'm doing wrong?
Thank you.