discoveryjs/JsonDiscovery

Extension doesn't load for large files

Closed this issue · 7 comments

exdis commented

Hey, @texastoland! Thank you for your report, and sorry for the long delay but unfortunately the problem not related to the JsonDiscovery. The problem is that the document you provided for the example is not valid JSON. It contains JS-style comments which is not allowed by JSON specification, probably it is JSON5. These comments cause JSON parsing to fail. I tested this document without comments and everything works fine.
Support for more specific JSON formats is very interesting, but it will affect performance, so it will remain an idea for now, but maybe we will implement something like that in the future.

Ah I didn't check that! I think the extension should still provide some kind of user feedback on parse error though. My initial assumption was that it had gotten uninstalled somehow.

exdis commented

Yes we have the feature to display errors to the user, but it only works when JSON is found and the extension is initialized. In this case we fail at the moment of JSON parsing. But anyway I'll think what I can do about it, thanks for the idea!

At least if the URL is .json? I also struggled to find out how to manually input JSON into the extension. Although that's rather edge case.

exdis commented

Just because a URL ends with .json doesn't mean it's JSON and vice versa, so we do some checks to make sure it's JSON.
For manual JSON input you can read the README:

Working with local files
Navigate to chrome://extensions

  • Find JsonDiscovery
  • Click "Details" button
  • Toggle "Allow access to file URLs" switch

And after that you will be able to open JSON files in your browser and the extension will work with them

Just because a URL ends with .json doesn't mean it's JSON and vice versa, so we do some checks to make sure it's JSON.

Technically true but it's a reasonable assumption. I can't think of a .json URI returning anything else. Showing an error message would resolve my particular issue.

For manual JSON input you can read the README:

I missed that! I kept trying to click the button and ended up just navigating to the web version.

Thanks for the help 🙌🏼

exdis commented

Showing an error message would resolve my particular issue.

Yes, I think I will make some kind of user hint for such cases