Created
November 5, 2012 02:05
-
-
Save clonn/4014891 to your computer and use it in GitHub Desktop.
Node.js parse JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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