25

jvacek I agree 🙂

Can someone find a superfast and supersmall piece of JS code that formats even the biggest of JSON responses in a nice way?

    I would love to also have the filtering functionality, plus header inspection if possible

    This might be a stretch but is it possible that Firefox' implementation is actually a JS script? it generates a full DOM and everything

    • Vlad replied to this.

      Vlad it has its limits 😉 I think it's safe to re-use those limits if Firefox deems them appropriate. It works well for "normal" workloads.

      • Vlad replied to this.

        The second one does not work for me in Orion. It pretty-prints the output, but doesn't do any collapsing or highlighting. Neither of them were able to load the large JSON file for me

          ED: looks like the big file might work even with the firefox viewer maybe? Might also explain why the other ones don't format it

            2 months later

            Shouldn't just JSON.stringify() be a good baseline for json outputs, though?
            Highlighting and such can come later?

            • Vlad replied to this.

              tiw Sounds like a good idea.

              Can you supply a pieace of code that would do that? (so it can be run on a .json page in console and produce meaningful output?)

                Something like document.body.firstChild.innerHTML = JSON.stringify(JSON.parse(document.body.firstChild.innerHTML), null, 4) probably suffices, at least to me.

                • Vlad replied to this.

                  tiw Perfect, exactly what we needed!

                    3 months later
                    7 months later

                    Want to note that this extension (a port of Firefox's JSON viewer) seems to work flawlessly (after disabling Orion's current JSON formatting). https://chrome.google.com/webstore/detail/json-viewer/efknglbfhoddmmfabeihlemgekhhnabb

                    I've tried it on a number of sites (including some larger JSON files) and haven't experienced any issues whatsoever.

                    Would love to see this viewer brought in as a built-in feature. The source for this port is here, and is MIT-licensed so could be used as the basis for an implementation in Orion: https://github.com/pd4d10/json-viewer

                    • Vlad replied to this.
                      No one is typing