I have this json coming from my service
{
"CorIndicador":"VERMELHO",
"DadosIndicador":"{\"Previsto\":25784.686452608872,\"Realizado\":95258.9557949728}",
"TipoIndicador":1
}
And I have this class
public class FaturamentoResponse
{
public string CorIndicador { get; set; }
public double Previsto { get; set; }
public double Realizado { get; set; }
}
When I do this
var resp = JsonConvert.DeserializeObject<FaturamentoResponse>(response.Content);
a var resp comes CorIndicator only populated. Predicted and Realized is coming "0". I'm sure it's because of the DataIndicator. How do I populate the Predicted and Realized properties.
EDIT1
Looking good at my folder, 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 it's the one json should get, right?
EDIT2 I did the form below and gave this error
Unhandled Exception:
Newtonsoft.Json.JsonSerializationException: Error converting value "{" Forecasted ": 55022.101316145665," Performed ": 19938.330920384418}" to type 'Operational.Models.DadosResponse'. Path 'DataDisplay', line 1, position 112.
EDIT3
I changed the class I had posted to DataResponse and the DataIndicator is string
.