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

Collapse icon not appearing for JSON with top-level object #221

Closed jd-brennan closed 1 year ago

jd-brennan commented 1 year ago

The icon for collapsing doesn't appear for JSON files that are an object, {}. Only seems to work for JSON files are are an array, [].

For instance: https://raw.githubusercontent.com/callumlocke/json-formatter/master/tsconfig.json image

Collapsing still works. You can click to the left of "compilerOptions" to collapse.

callumlocke commented 1 year ago

I can't replicate. Are you using the extension installed from the store or the latest code from GitHub? And what browser/OS?

jd-brennan commented 1 year ago

I'm using the extension from the store. Version 0.6.3 MacOS 12.0.1 Chrome Version 108.0.5359.71 (Official Build) (arm64)

Could it have something to do with color scheme? Just a SWAG.

jd-brennan commented 1 year ago

Noticed that it only seems to happen with githubusercontent which serves up the file with Content-Type: text/plain

If I copy the same file to my laptop and serve it from there with Content-Type: application/json then the icons appear.

jd-brennan commented 1 year ago

Also installing the Chrome extension HTTP Headers makes JSONFormatter show the icons. Very strange!

callumlocke commented 1 year ago

Hmm that is strange. Well now v0.7.0 is now out (it just got released on the store about 30 minutes ago) and everything has been refactored a lot, so can you see if the problem still exists now? Hopefully you should get auto-updated, or you might need to restart Chrome.

jd-brennan commented 1 year ago

Yes! Working in 0.7.0. Thanks. And I did get auto-updated. Didn't even have to restart Chrome.