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

Plugin not working in Nvidia's link #240

Closed miku1958 closed 1 year ago

miku1958 commented 1 year ago

The plugin is nor working in this link https://gfwsl.geforce.com/services_toolkit/services/com/nvidia/services/AjaxDriverService.php?func=DriverManualLookup&psid=120&pfid=929&osID=57&languageCode=2052&beta=0&isWHQL=1&dltype=-1&dch=1&upCRD=0&qnf=0&sort1=0&numberOfResults=20

Anyone knwo how to fix it?

c4ldas commented 1 year ago

It seems the plugin did not recognize the page as a JSON response, not sure if it is due to the special characters or something else. But, as a workaround, you can type this on your browser console (F12) and check the json response in there. It won't be available on the webpage, though, only in the browser console.

json = JSON.parse(document.getElementsByTagName("body")[0].innerText)

callumlocke commented 1 year ago

It's because that link is served with the header content-type: text/html; charset=UTF-8, so it is technically an HTML web page.

For this extension to run, the endpoint needs to be served as application/json (or technically any non-HTML text MIME type like application/javascript or even text/plain should work too, if the contents happen to parse as JSON).