Created
August 30, 2011 21:23
-
-
Save joshkehn/1182088 to your computer and use it in GitHub Desktop.
Quick CLI JSON tester
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'), | |
good = true; | |
var pit = fs.readFileSync(process.argv[2], 'utf8'); | |
try { | |
JSON.parse(pit); | |
} catch (e) { | |
console.log('Unable to parse file.'); | |
console.log(e); | |
good = false; | |
} | |
if (good) | |
{ | |
console.log('File good.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment