callumlocke / json-formatter

Makes JSON easy to read.
https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en
BSD 3-Clause "New" or "Revised" License
3.76k stars 859 forks source link

Formatter fails on large file #234

Open EnnFour opened 1 year ago

EnnFour commented 1 year ago

Looks like this fails when looking at the NBA schedule. It's ~120k lines, so maybe I've run into a size limitation? https://data.nba.com/data/10s/v2015/json/mobile_teams/nba/2016/league/00_full_schedule.json

callumlocke commented 1 year ago

Yes it currently has a hardcoded limit of 3,000,000 bytes (3 Mb). I added this years ago because I was worried about performance problems on huge JSON documents.

But I'm working on an update that will let you change this in the Options UI. (I might also increase the default limit, as computers are faster now.)

Until then, if you have an urgent need, you could edit it and install from source: just clone the repo, edit this line, and then follow the readme instructions to build & install from source.

callumlocke commented 1 year ago

btw it looks like that URL is just a little over the limit: 3360961 bytes (just checked with $('body>pre').textContent.length in devtools)

CheckeredFlag commented 1 year ago

I'd love to see this configurable too. I just hit a limit of 3.4MB.

sglessard commented 11 months ago

I've edited content.entry.ts to increase the rawLength condition. The built extension converts the json when > 3000000 bytes but for some reason it does not load the CSS. Tags/classes are present in source code but no style is displayed.

<style id="jfStyleEl">[object Object]

@media (prefers-color-scheme: dark) {
[object Object]
}</style>
DarrenSem commented 10 months ago

Yes it currently has a hardcoded limit of 3,000,000 bytes (3 Mb). I added this years ago because I was worried about performance problems on huge JSON documents. ... Until then, if you have an urgent need, you could edit it and install from source: just clone the repo, edit this line, and then follow the readme instructions to build & install from source.

@callumlocke Thanks for this extension. I noticed that line 63 that you linked to above, it sets a few properties including note: but I can't see anywhere in the repo where that value is ever used (or the other 2 properties tbh). It doesn't even console.log {note}, which I was expecting to find at the very least... instead it seems like it will silently fail, so the user will not see any popup warning explanation or any change to the extension icon etc. 😟

const resultPromise = (async (): Promise<{
  formatted: boolean
  note: string
  rawLength: number | null
}> => {
...
return {
      formatted: false,
      note: `Too long`,
      rawLength,
}
arikanorh commented 8 months ago

Are we going to have this feature anytime soon? I love this extension but my jsons are too big

gavalierm commented 6 months ago

+1