I have the following serialized class:
[System.Serializable]
public class Question
{
public string question;
public List<string> answers;
public string correct;
public Question(string question, List<string> answers, string correct){
this.question = question;
this.answers = answers;
this.correct = correct;
}
}
And the following array of questions
:
questions = new List<GameManager.Question>();
questions.Add(new GameManager.Question("2+2?", new List<string> { "4", "5", "6" }, "4"));
questions.Add(new GameManager.Question("2*2?", new List<string> { "1", "4", "8" }, "4"));
questions.Add(new GameManager.Question("2/2?", new List<string> { "0", "1", "2" }, "1"));
I need to store this information as json
format and load it to init the question game.
How I can load an array of questions using json?