Answers for "parse json file fs"

8

read json file node js

function readJsonFile(file) {
    let bufferData = fs.readFileSync(file)
    let stData = bufferData.toString()
    let data = JSON.parse(stData)
    return data
}
Posted by: Guest on June-07-2021
1

read json using fs

let jsonData = require('./student.json');

console.log(jsonData);
Posted by: Guest on April-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language