Read a json file in JavaScript [closed]

  javascript, json

I did a website for an online auditory experiment (I used JavaScript) which will be hosted on the servers and distributed. We just have to put the files of our site on their GitLab and it returns us a link to distribute the experiment.

This experiment have many conditions so I would like to do one json file with the parameters (stored with the other files of the website) for each condition and load the good one in an object when the participant goes to my website.

My problem are :

  1. I don’t know how to do. I believe my question may have a lot of answers on the web but I did a lot of research without understanding what I read. I used XMLHttprequest to load some sounds, should I use this solution and parse the result ? When I searched about this topic I found so much complicated things that I’m lost now.

  2. If the answer is no, I saw something about ajax, I don’t know if it is possible but I wanted to try it first in local before uploading the website because it’s very easier to make some tests. It seems that it’s different to use json in local.

Source: Ask Javascript Questions