cleanjson

Format JSON document from stdin as 'comma-first' JSON

$ npm install -g cleanjson
  1. Publish your "dirty" JSON at some URL using services such as http://hastebin.com, http://gist.github.com or http://cl.ly

  2. Acquire a URL that points to "raw" JSON, such as: http://goo.gl/7IiVZ

  3. Run a command such as:

    $ curl -Ls http://goo.gl/7IiVZ | cleanjson
  4. Enjoy

var cj = require('cleanjson');
 
var input = '{"a": 13123, "b": "13123", "ccc": 112}';
 
cj.clean(input, function(errcleanJSON) {
  
  console.log(cleanJSON);
  process.exit(0);  
  
});

will produce following output:

{
  "a": 13123
, "b": "13123"
, "ccc": 112
}