Skip to content
Sign upLog in
← Back to Community

working with json data in js file

Profile icon
quanta66

how can I access data from a JSON file when am working in JS file

thank you

Voters
Profile icon
MarinaBoscato
Profile icon
quanta66
Comments
hotnewtop
Profile icon
eco27

you can use the built-in file system module

const fs = require("fs") const school_data = JSON.parse(fs.readFileSync("school_data.json")) console.log(school_data)
Profile icon
quanta66

@MrEconomical

thank you