WelliSolutions/HugeJsonViewer

Limit "preview" of clicked array in treeview

Opened this issue · 0 comments

Describe the bug
I needed this tool to inspect a JSON log dump that's almost 200 mb.
And in doing so I found out that care should be taken when clicking arrays in the treeview.

Because one of these was on the 2nd level of the file and I accidentally clicked on it which froze the app up.
Likely because it started generating the "Array data" for all 5k entries in that array and their entire structure...

To Reproduce
Open a JSON file with an array close to the root that contains a lot of deep structured entries. Something like:

{
  array: [
    { complex object },
    ... // couple hundred or more like the above
  ]
}

Expected behavior
I would've expected the app to "keep an eye" on how much data for the "preview" it already generated and eventually realize, that if the first item already generated over 5 kb of text, then it might not be a good idea to fully iterate further.
And instead all remaining entries should be iterated very shallowly, if at all.

Maybe it would be a good approach to only iterate the first item in the array for 1 level, so the keys could be shown with their data/datatype, then iterate all remaining items the same way and then check how much text that generated.
If it's already several dozen kb at that point, then iterating deeper wouldn't be very beneficial.

This app is meant for large data structure after all, so it shouldn't lock or eventually kill itself by generating hundreds of kb of text for a textbox.

Desktop (please complete the following information):

  • OS: Windows 10 x64 19045.3693
  • Version of HugeJsonViewer: 0.4.12.19 portable

Additional context
I'll see if I can throw together a script that generates a JSON file that remotely shows the issue.