How do you access the json object using fetch in Node.Js?
I can fetch the json and print everything to console.log with no problem, but everything I have tried to get specific values from the json are not working. Can anyone point me in the right direction?
fetch('https://webhostapp.com/example.json')
.then(res => res.json())
.then(json => console.log(json)) //this prints everything correctly
//this is an example of the json
//How can I get the value of "1": "n111" for example?
{
"1": {
"Question": 1,
"n111": "Three men have just rode into town and haven't checked in with
your office to declare if they have any weapons or not. Do you want to
search them?",
},
"2": {
"Question": 2,
"n111": "Word has it that the Saloonkeeper’s card games are rigged. Do
you want to investigate to check if the decks are marked?",
}
}