I am looking to read a json file, namely config.json
from a AppScript to generate a Google Form from the meta data in the config.json
. I am not sure how to read the JSON file - could someone help me with it please? Some example code would be greatly appreciated.. Thanks
If you're like me, you may have looked here to see how to store the JSON file inside the actual Apps Script project (e.g. alongside Code.gs) and then retrieve it in Code.gs.
I did this:
//Assume the file you added to your project is called 'my-json.html'
const jsonString = HtmlService.createHtmlOutputFromFile("my-json.html").getContent();
const jsonObject = JSON.parse(jsonString);