Hi everybody. I'm pretty new to Construct 2, but even newer to JSON.
I'm in them midst of building a quiz-type of game that needs to be fed content from an external .json file. I know how I would do this in xml, but I feel my solution for using json might be a bit clunky...so I was wondering if I could get some feedback.
In XML, I could structure something like this:
<questionBundle>
<question>
<questionPrompt>Question 1</questionPrompt>
<answer>Choice A</answer>
<answer>Choice B</answer>
</question>
<question>
<questionPrompt>Question 2</questionPrompt>
<answer>Choice A</answer>
<answer>Choice B</answer>
<answer>Choice C</answer>
</question>
</questionBundle>
I would then iterate through it, and set up an array like: [[Question 1][Choice A, Choice B, Choice C]]
But in json, I don't seem to have the ability to layer my arrays. So my feeble newbie attempt is something like this:
{"c2array":true,
"size":[2,2,1],
"data":[[["Question 1"],["Choice A|Choice B"]],
[
["Question 2"],["Choice A|Choice B|Choice C"]]]
}
Then I'd use tokenat to parse through the "Choice A|Choice B" strings...
So...sorry about the length, but does this seem like a legitimate way to store layered data like this? Or am I going about it in a super clunky manner? Anyway, I appreciate feedback! Thanks.