I don't know what I'm doing wrong, I have an extremely simple Json, but I can't deserialize it, I just don't know what else to try. the JSON is this:
{"value":[{"Id":"2b0af0d7-2a7b-4489-a205-8cb9aef88a1b","Code":"1","Name":"Empresa Pripal"},{"Id":"39e415d3-d971-404a-b5ca-fc7f039dd859","Code":"3","Name":"Empresa 3 "},{"Id":"b8405286-a3d1-4d40-9a64-ec8fde498342","Code":"75","Name":"Empresa pruevas"},{"Id":"ec624692-5383-44a8-822a-3493ff177c02","Code":"99","Name":"Empresa 99"}]}
the entity is:
public class Empresas
{
[JsonPropertyName("value")]
IEnumerable<Empresa> value { get; set; }
}
public class Empresa
{
public string Id { get; set; }
public string Code { get; set; }
public string Name { get; set; }
}
And I try to deserialize the Json like so:
Empresas tryObject = JsonSerializer.Deserialize<Empresas>(data);
But tryObject is always null. It is obvious that I am doing something wrong, can you help me please.
Thank you very much.