Created
May 16, 2010 07:26
-
-
Save pquerna/402736 to your computer and use it in GitHub Desktop.
This file contains 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
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 |
This file contains 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'); | |
// this works | |
x = JSON.parse('{"secret": "super"}') | |
fs.readFile('test.json', function(err, data) { | |
// this doesn't | |
p = JSON.parse(data); | |
}); |
This file contains 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
{ | |
"secret": "super" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment