0
I need to get the id
of that code JSON
using C#
:
[{"nome":"Gabriel Ferreira","cidade":"São Paulo","uf":"SP","id":"4274892"}]
Can someone advise me how I can do this in the best way, because I’ve tried with JSON.net
as follows:
public class pegarID
{
public string nome { get; set; }
public string cidade { get; set; }
public string uf { get; set; }
public string id { get; set; }
}
pegarID pegarid = JsonConvert.DeserializeObject<pegarID>(responseString);
Console.WriteLine(pegarid.id);
But it didn’t work...
Has there been an exception? If so, what was it? If not, what didn’t work? The property came empty?
– Eric Wu