Last active
August 25, 2023 15:52
-
-
Save CoderPrans/4fef0ec7fec3935533d4ce567d9a5819 to your computer and use it in GitHub Desktop.
A Min browser's userscript that pretty-prints raw JSON for slightly better view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name JSON Viewer | |
// @match * | |
// @run-at document-start | |
// ==/UserScript== | |
let pretags = document.querySelectorAll( | |
'[style="word-wrap: break-word; white-space: pre-wrap;"]', | |
); | |
pretags.forEach(pre => { | |
let text = pre.textContent; | |
let parsed = JSON.parse(text); | |
pre.textContent = JSON.stringify(parsed, null, 2); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please create another gist with a sample json to test your userscript