0
I got this json coming from my service
{
"CorIndicador":"VERMELHO",
"DadosIndicador":"{\"Previsto\":25784.686452608872,\"Realizado\":95258.9557949728}",
"TipoIndicador":1
}
And I got that class
public class FaturamentoResponse
{
public string CorIndicador { get; set; }
public double Previsto { get; set; }
public double Realizado { get; set; }
}
when I do that
var resp = JsonConvert.DeserializeObject<FaturamentoResponse>(response.Content);
to var Resp comes Corindicador only populated. Predicted and Realized is coming "0". I’m sure it’s because of the Dadosindicator. How I populate the properties Predicted and Realized.
EDIT1
looking at my briefcase, I saw this class
[DataContract]
public class DadosResponse
{
[DataMember]
public TipoIndicador TipoIndicador { get; set; }
[DataMember]
public string CorIndicador { get; set; }
[DataMember]
public string DadosIndicador { get; set; }
}
I think she’s the one who should get the json, right?
EDIT2 I did it the way down and made that mistake
Unhandled Exception:
Newtonsoft.Json.Jsonserializationexception: Error Converting value "{"Predicted":55022.101316145665,"Realized":19938.330920384418}" to type 'Operativo.Models.Dadosresponse'. Path 'Dadosindicator', line 1, position 112. occurred
EDIT3
I switched to the class I had posted Dadosresponse and there the Data is string
.