NodeJS/Backend. 0: request not initialized. Load JSON File in JavaScript. read data from json file in javascript without fs. 1 comment. js write to json file node. If you have such a string that you obtained from somewhere, you need to first parse it into a JavaScript // 1. create string variable const myStringVar = `module.exports = [\'require(\'raw!./file1.txt\')\', ];`; // 2. then save this into myTxtFiles.js // 3. then require the file In HTML, this is done by adding type="module" to the