I have an example of what I'm trying to deserialize below and I'm getting a bunch of different errors when I try to pull the data. All I want is to pull the id value but I can't seem to figure it out.
{"object":"payments","entry":[{"id":"546787862118679","time":1417135022,"changed_fields":["actions"]}]}
public class Entry
{
public string id { get; set; }
public int time { get; set; }
public List<string> changed_fields { get; set; }
}
public class RootObject
{
public string @object { get; set; }
public List<Entry> entry { get; set; }
}
dynamic result = new StreamReader(request.InputStream).ReadToEnd();
var items = JsonConvert.DeserializeObject<RootObject>(result);
string paymentID = items.entry.FirstorDefault().id;
Returns this error:
'System.Collections.Generic.List' does not contain a definition for 'FirstOrDefault()'
using System.Linq;to top of the file.