Skip to content

Instantly share code, notes, and snippets.

@joshkehn
Created August 30, 2011 21:23
Show Gist options
  • Save joshkehn/1182088 to your computer and use it in GitHub Desktop.
Save joshkehn/1182088 to your computer and use it in GitHub Desktop.
Quick CLI JSON tester
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