Answers for "node program read json file"

4

read json file nodejs

const fs = require('fs');
const path = require('path');

let rawdata = fs.readFileSync(path.resolve(__dirname, 'student.json'));
let student = JSON.parse(rawdata);
console.log(student);
Posted by: Guest on April-13-2020
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