json-viewer
json-viewer copied to clipboard
Option to have compact view for small arrays/objects
It would be nice to have an option to have a compact display for small arrays/objects, e.g. to display "foo": [1, 2, 3]
as "foo": [1, 2, 3]
on one line rather than the only choices being "collapsed and none of the contents visible" or "expanded and taking up many lines unnecessarily".
This seems like a reasonable idea. Like many ideas, the implementation is more complex than the description.
for small arrays/objects
@jribbens As a starting point to help someone who might want to implement it: what is your definition of "small" (expressed in terms of code)?
Well the easiest way would be to simply say something like "less than 40 characters when expressed as JSON", or a slightly more complicated way would be "when expressed as JSON, does not wrap onto the next line in the current browser window" (or indeed both rules at once). Plus perhaps "does not contain any objects or arrays".
Seems like it has not implemented in 2023, that would be great to see one-line display view. How to implement ?
@bora89 Bit cheeky of me, but due to lack of progress on this I went and wrote my own JSON extension from scratch which fixes this and all the other issues I had with this and other existing JSON extensions. Also my one is the only one that can cope with large JSON files (up to 500MB...) :-) https://chrome.google.com/webstore/detail/json-wrangler/kgmhfbhlcdhjldpbjgoaljbpendgkede?hl=en-GB
@jribbens Great, will check it out!