When I try to assign values to an object from a deialized result (from an API, JSon). I get the following error:
Unexpected token while deserializing object: PropertyName. Path 'studentID'.
Here is part of my code:
resultJSonRequest = resultWebService;
IList<JToken> results = JasonResultList.ToList();
IList<Parameters> searchResults = new List<Parameters>();
searchResultsFromJason = searchResults;
foreach (JToken resultJAson in results)
{
Parameters searchResult = resultJAson.ToObject<Parameters>();
searchResults.Add(searchResult);
}
Where I fall is on the line:
Parameters searchResult = resultJAson.ToObject<Parameters>();
This is my class parameters:
[Serializable]
class Parameters
{
public string studentID { get; set; }
public string facultyID { get; set; }
}
Do you know how to fix it?
Thanks