Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Doubt consuming RestService

$
0
0

Hi

I'm consuming my webAPI and I receive this JSON object

"[{\"id\":\"AAGUI577\",\"name\":\"DO C/ Barranco\",\"workStartDate\":\"0001-01-01T00:00:00\",\"planningEndDate\":\"0001-01-01T00:00:00\",\"historicoDate\":\"0001-01-01T00:00:00\",\"projectClosed\":true,\"phaseClosed\":false},
{\"id\":\"AAGUI584\",\"name\":\"Farmacia\",\"workStartDate\":\"0001-01-01T00:00:00\",\"planningEndDate\":\"0001-01-01T00:00:00\",\"historicoDate\":\"0001-01-01T00:00:00\",\"projectClosed\":true,\"phaseClosed\":false}
.....
That I want to map to this model
public class ProyectoData
{
[JsonProperty("id")]
public string Id { get; set; }

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("workStartDate")]
    public string WorkStartDate { get; set; }

    [JsonProperty("planningEndDate")]
    public string PlanningEndDate { get; set; }

    [JsonProperty("historicoDate")]
    public string HistoricoDate { get; set; }

    [JsonProperty("projectClosed")]
    public bool ProjectClosed { get; set; }

    [JsonProperty("phaseClosed")]
    public bool PhaseClosed { get; set; }
}

But when I execute this
string content = await response.Content.ReadAsStringAsync();
proyectoData = JsonConvert.DeserializeObject(content);

proyectoData is null

Any idea please?
regards


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>