Horje
how to get json data from json file in node js Code Example
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);
read json file node js
function readJsonFile(file) {
    let bufferData = fs.readFileSync(file)
    let stData = bufferData.toString()
    let data = JSON.parse(stData)
    return data
}
how to get json data from json file in node js
const fs = require("fs"); 
var posts = [];

fs.readFile('./data/posts.json', 'utf8', (err, data) => {
                if (err) throw err;
                posts = JSON.parse(data);
            });




Javascript

Related
email address hide characters javascript Code Example email address hide characters javascript Code Example
find the second largest number in an array javascript Code Example find the second largest number in an array javascript Code Example
image and video lightbox react Code Example image and video lightbox react Code Example
upload preview image js Code Example upload preview image js Code Example
Progress bar loader angular Code Example Progress bar loader angular Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7