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

Print large arrays in a grid #36

Open iva2k opened 2 months ago

iva2k commented 2 months ago

I like NeatJSON - great package!

I encountered a need to display JSON objects containing an array with 1000 to 2000 numbers. I was able to make NeatJSON to print it in one line or one column only, nothing else.

It would be extremely useful to have it print arrays in lines with as many numbers as fit across the given width, and end up with a more compact display. 1000 numbers can be 25 numbers by 40 lines - much better than 1000 lines vertically or 8000 chars horizontally with extremely long scrollbar.

A separate setting of how many elements to print across can be useful (e.g. when the data has certain repetition, and width limit is chosen for other reasons) .

A separate setting to pad all Array elements to the same width can be useful (so they show up aligned in columns).