Skip to content

Instantly share code, notes, and snippets.

@totherik
Created February 6, 2014 19:36
Show Gist options
  • Save totherik/8851099 to your computer and use it in GitHub Desktop.
Save totherik/8851099 to your computer and use it in GitHub Desktop.
A naïve msjon impl for node.js.
#!/usr/bin/env node
var chunks = [];
process.stdin.on('data', chunks.push.bind(chunks));
process.stdin.on('end', function () {
var json;
json = Buffer.concat(chunks).toString('utf8');
json = JSON.parse(json);
json = JSON.stringify(json, null, 2);
process.stdout.write(json);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment