Help with JSON and typescript

I have a quiz with 3 sections, 5 levels, 4 branches json looks something like this
{
"1":{
"1":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"2":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"3":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"4":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"5":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
}
},
"2":{
"1":{ //and so on
{
"1":{
"1":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"2":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"3":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"4":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
},
"5":{
"a":["question","hint"],
"b":["question","hint"],
"c":["question","hint"],
"d":["question","hint"]
}
},
"2":{
"1":{ //and so on
How can I make an interface in typescript so that i can access the branch like const q = data.1.1."a" or maybe modify the json file in a way that makes it work
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
SneaX
SneaXOP2y ago
would this work with the same json or would i have to modify it
Want results from more Discord servers?
Add your server