Skip to content

Instantly share code, notes, and snippets.

@cgkio
Created November 25, 2013 14:49
Show Gist options
  • Save cgkio/7642339 to your computer and use it in GitHub Desktop.
Save cgkio/7642339 to your computer and use it in GitHub Desktop.
Read local JSON file with node.js
var fs = require('fs');
var file = __dirname + '/data/filename.json';
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
obj_pulseconfig = JSON.parse(data);
console.dir(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment