Faleij / json-stream-stringify

JSON.Stringify as a readable stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trailing comma when replacing last key

baffles opened this issue · comments

If you return undefined for the last key in an object, a trailing comma is rendered in the output JSON.

For example:

var s = new JsonStreamStringify({a: 12, b: 14, c: 13}, function (k, v) { if (k == 'c') return undefined; return v; });
s.pipe(process.stdout); // outputs {"a":12,"b":14,}

@baffles Thank you for reporting this issue, it should now be fixed in 2.0.1 - which should be on npm in a few minutes.

2.0.1 is now released