I have a json setup like the below. I import and convert that json file into a variable called “questions”. I have two more global variables: questionNumber & randomQuestionSelection (the second of which is randomized to be 0 or 1).
The problem is I can easily access the text of my questions using:
GlobalVariableString(questions[GlobalVariable(questionNumber)].0.question)
But I want to use something like this, but its just not working:
GlobalVariableString(questions[GlobalVariable(questionNumber)].GlobalVariable(randomQuestionSelection).question)
Any suggestion?
my json:
[
[
{
"question":"This is the first question and the first option?",
"feedback":"This is the feedback for the first question and first option.",
"answerA":{
"text":"answer A text",
"correct":true
},
"answerB":{
"text":"answer B text",
"correct":false
},
"answerC":{
"text":"answer C text",
"correct":false
},
"answerD":{
"text":"answer D text",
"correct":false
}
},
{
"question":"The is the first question and the SECOND option.",
"feedback":"Feedback for first question and second option",
"answerA":{
"text":"answer A text",
"correct":true
},
"answerB":{
"text":"answer B text",
"correct":false
},
"answerC":{
"text":"answer C text",
"correct":false
},
"answerD":{
"text":"answer D text",
"correct":false
}
}
],
[
{
"question":"This is the second question and the first option",
"feedback":"This is the feedback for the second question and first option.",
"answerA":{
"text":"answer A text",
"correct":true
},
"answerB":{
"text":"answer B text",
"correct":false
},
"answerC":{
"text":"answer C text",
"correct":false
},
"answerD":{
"text":"answer D text",
"correct":false
}
},
{
"question":"This is the second question and SECOND option.",
"feedback":"This is the feedback for the second question and second option",
"answerA":{
"text":"answer A text",
"correct":false
},
"answerB":{
"text":"answer B text",
"correct":false
},
"answerC":{
"text":"answer C text",
"correct":true
},
"answerD":{
"text":"answer D text",
"correct":false
}
}
]
]