I am using the following:
[System.Serializable]
public class Choice
{
public string choice;
public int votes;
}
[System.Serializable]
public class RootObject
{
public string question;
public string published_at;
public List<Choice> choices;
}
To deserialize the following JSON:
[ { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift", "votes": 2048 }, { "choice": "Python", "votes": 1024 }, { "choice": "Objective-C", "votes": 512 }, { "choice": "Ruby", "votes": 256 } ] } ]
And I am getting this Error message in console : ArgumentException: JSON must represent an object type. Please tell me what I am doing wrong.