Skip to content

Instantly share code, notes, and snippets.

@clonn
Created November 5, 2012 02:05
Show Gist options
  • Save clonn/4014891 to your computer and use it in GitHub Desktop.
Save clonn/4014891 to your computer and use it in GitHub Desktop.
Node.js parse JSON
var fs = require('fs');
var file = __dirname + '/test.json';
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
data = JSON.parse(data);
console.dir(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment