1
I’m making a mistake when I take the return of a REST service and try to deserialize to a C object#.
The REST Service returns me to the following structure(json):
{
"Marcacoes_Ponto_Response":
{
"Item":
{
"Codigo_Retorno":"S"
,"Mensagem":"Operação realizada com sucesso"
,"Numero_Fabricacao_REP":"00099999999999990"
,"PIS":"12409663348"
,"Data_Marcacao":"20092019"
,"Hora_Marcacao":"093715"
}
}
}
In C#code, I use the following code to deserialize an object:
var dadosFuncionario = JsonConvert.DeserializeObject<ResultPontoDigitalSAP>(responseFuncionario.Content.ReadAsStringAsync().Result);
The object definition used in the above codes follows below:
public class ResultPontoDigitalSAP
{
public List<Marcacoes_Ponto_Response> Marcacoes_Ponto_Response { get; set; }
}
public class Marcacoes_Ponto_Response
{
public string Codigo_Retorno { get; set; }
public string Mensagem { get; set; }
public string Numero_Fabricacao_REP { get; set; }
public string PIS { get; set; }
public string Data_Marcacao { get; set; }
public string Hora_Marcacao { get; set; }
}
But when the JSON result is returned to application I take a C# JSON formatting error when I try to deserialize to the object set above.
Someone knows what I’m doing wrong?
Dear Oscar Filho here is Portuguese ... can translate your question?
– novic
Sorry, corrected. Thank you.
– Oscar Filho
If it is the way it is in the question it is object object and not array object! it should be that. Good if reopen I answer
– novic
@Virgilionovic has reopened :)
– George Wurthmann