When doing nko, there were some complaints about jitsu's generated package.json files imposing a particular whitespace style on the developers. Since many developers are persnickety about whitespace (and can cause issues during file merges), it would be nice to find a way to work around this, such as jsup.
Edit: The particular issue of basic indentation detection has been addressed since this issue was created, but preservation of comma-first, etc., is still an open issue.
Needless to say, this is pretty low priority.
From a more recently submitted issue. This will be of interest here:
When jitsu runs, it reads and writes to your package.json for a number of reasons. Internally, what happens is something like this:
var fs = require('fs');
var data = JSON.parse(fs.readFileSync(__dirname + '/config.json').toString());
// do some stuff with data
data.foo = "bar";
fs.writeFileSync(__dirname + '/config.json', JSON.stringify(data, true, 2));
The upshot is that we're able to validate your package.json and help you make it valid if it's not ready to go to our servers. The downshot, of course, is that JSON.stringify isn't all that sophisticated.
We would love it if there was a JSON stringifyer out there that could handle reading, writing and updating new properties in an existing JSON string, and if there were a pull request such that this problem were taken care of in jitsu we would accept.
The project that most likely has the relevant code is nconf. You may also be interested in jsup but I believe it can only modify in-place values.