Skip to content

Instantly share code, notes, and snippets.

@pquerna
Created May 16, 2010 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pquerna/402736 to your computer and use it in GitHub Desktop.
Save pquerna/402736 to your computer and use it in GitHub Desktop.
BlackWater:node-tests chip$ node test-json.js
/Users/chip/work/temp/node-tests/test-json.js:8
p = JSON.parse(data);
^
node.js:176:9
var fs = require('fs');
// this works
x = JSON.parse('{"secret": "super"}')
fs.readFile('test.json', function(err, data) {
// this doesn't
p = JSON.parse(data);
});
{
"secret": "super"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment