Answers for "json read nodejs"

2

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 data from json using node

const fs = require('fs');

let rawdata = fs.readFileSync('student.json');
let student = JSON.parse(rawdata);
console.log(student);
Posted by: Guest on February-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language