I have never worked before with JSON data. I'm trying to deserialize the following line:
{"Mails":[null,{"ID":"[email protected]","Status":true},{"ID":"[email protected]","Status":false}]}
I'm using the following code but it's not working:
public Boolean checkValidLicense(string usermail)
{
Boolean validUser = false;
HttpWebRequest req = WebRequest.Create("https://popping-heat-1908.firebaseio.com/.json") as HttpWebRequest;
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(resp.GetResponseStream());
string json = reader.ReadToEnd();
dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
foreach (var item in result.Mails)
{
if (usermail == item.ID && item.Status == "true")
{
validUser = true;
break;
}
}
return validUser;
}
I'm getting:
'Newtonsoft.Json.Linq.JValue' does not contain a definition for 'ID'.
<T>) API?