Phrogz / NeatJSON

Pretty-print your JSON in Ruby, JS, or Lua with more power than JSON.stringify or JSON.pretty_generate
http://phrogz.net/JS/NeatJSON
MIT License
108 stars 19 forks source link

Failed formatting for this JSON object #6

Closed Phrogz closed 8 years ago

Phrogz commented 8 years ago
var obj = '{ "abcdefghij":[{ "abcdefghijklmnop":{} }] }';
var json = neatJSON(obj, {wrap:1, short:true, aroundColonN:1} );
// TypeError: Cannot read property '0' of undefined

Removing characters from either property name fixes the problem, as does removing the aroundColonN option. (?!)

Phrogz commented 8 years ago

Simpler repro:

var obj = {"foo":{}};
var json = neatJSON(obj, {wrap:1, short:true} );
// TypeError: Cannot read property '0' of undefined
Phrogz commented 8 years ago

Fixed in v0.6.1