Skip to content

Instantly share code, notes, and snippets.

@peny
Created October 30, 2012 15:33
Show Gist options
  • Save peny/3980969 to your computer and use it in GitHub Desktop.
Save peny/3980969 to your computer and use it in GitHub Desktop.
qod json field to .txt file
var filename = 'file.json';
var fs = require('fs');
var underscore = require('underscore');
var data = fs.readFileSync(filename).toString();
data = JSON.parse(data);
data = underscore.map(data,function(d){
//change this
return d.field;
});
data = underscore.uniq(data);
fs.writeFile('file.txt',data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment