json-viewer
json-viewer copied to clipboard
[Feature request] window.json variable
Hello,
Would it be possible to allow access to the inspected JSON data from devtools using a window.json variable, like nikrolls/json-formatter does ?
Thanks !
up, thanks
Bit of a workaround, but you can currently extract the raw JSON data from the page's #rawdata-panel container. Should help when trying to test code from the console.
const json = JSON.parse(document.querySelector('#rawdata-panel pre.data').innerHTML)
@st-jordy-de-koning Interesting !
@pd4d10 Any news on this ?
Thanks
Thanks for the suggestion!
We are going to upgrade to manifest v3. There seems to be a technical limitation to inject global variables after this upgrade, due to the CSP policy.
The extension you mentioned seems still stay at manifest v2, which has already been deprecated by Chrome officially.
I'll look into that.
If creating a window.json variable turns out to be truly impossible, I would like to suggest adding a button to the UI which, on click, would copy a const json code snippet to clipboard, that could be pasted into DevTools.
I'm also wondering if an alternative extensions store will some day exist, since there's no way Chromium-based browser users like us give up on adblockers anyway.
a button to the UI which, on click, would copy a
const jsoncode snippet to clipboard, that could be pasted into DevTools.
Perhaps the Copy button is the feature you want
No, this only copies the JSON value, but it will still require to write const json = JSON.parse('') into DevTools.
I assure you, automating this is a huge gain of time.
OK get your point.
The original purpose of this extension is to port Firefox's corresponding JSON Viewer, so we are trying not to add too many extra features to keep it consistent with the original one.
But I also agree that it's useful if someone wants to do some debug in the console.
Hello,
Any news on this ?
I tried to add this feature as a userscript, but the #rawdata-panel element remains empty until the Raw Data button is clicked, meanwhile I won't do something as dirty as automatically clicking on it then clicking back on the JSON button.
Thanks
@pd4d10 Please ? Thanks