render JSON data prettified?

Discussion of general topics about Seamonkey
Post Reply
Justinh
Posts: 381
Joined: November 13th, 2004, 7:03 pm
Location: Alabama

render JSON data prettified?

Post by Justinh »

Is there a way to make SM render JSON data in the prettified structure? This is when an API call is put in the URL bar.

SM renders as a single-line. Fx renders as a structure.

If there is a way to get this from the dev console, that would be appreciated also.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: render JSON data prettified?

Post by morat »

Try toggling the devtools.jsonview.enabled pref in SeaMonkey.

Test page
http://code.cdn.mozilla.net/devices/devices.json

I can disable the JSON viewer with the devtools.jsonview.enabled pref in Firefox.

JSON viewer
http://developer.mozilla.org/docs/Tools/JSON_viewer

Reference
http://searchfox.org/mozilla-release/so ... t/jsonview
Justinh
Posts: 381
Joined: November 13th, 2004, 7:03 pm
Location: Alabama

Re: render JSON data prettified?

Post by Justinh »

That pref apparently has no effect in SM.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: render JSON data prettified?

Post by morat »

I can pretty print a JSON page using the Browser Console in SeaMonkey Portable 2.53.7.1.

Menu Bar > Tools > Web Development > Browser Console

Code: Select all

(function () {
  var pre = content.document.createElement("pre");
  var jsonText = content.document.body.innerText;
  var jsonPretty = JSON.stringify(JSON.parse(jsonText), null, 2);
  content.document.body.appendChild(pre).innerHTML = jsonPretty;
})();
Maybe you can use the code snippet with the Custom Buttons or keyconfig or userChromeJS addon.

P.S.

I could not get the JSON viewer code to run in SeaMonkey.
User avatar
raj_bhaskar
Posts: 1946
Joined: November 7th, 2002, 3:50 am
Location: Glasgow, Scotland
Contact:

Re: render JSON data prettified?

Post by raj_bhaskar »

I still have an old version of JSONView installed. It looks like you can get old versions from Github: https://github.com/bhollis/jsonview/rel ... ter=v1.2.1

I've got 0.9 installed, and I don't think it was updated for WebExtensions until 2.0, so hopefully one of the XPIs from there should work.
User avatar
therube
Posts: 21699
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: render JSON data prettified?

Post by therube »

v1.2.4 looks to work.
But - there is no .xpi, so you have to "make" one.

"All" that needs to be added is an install.rdf.

You can pull that from the v1.0.2 version (.xpi).
Also, its install.rdf needs a SeaMonkey section added to it.

Code: Select all

   <em:targetApplication>
      <Description>
        <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
        <em:minVersion>2.42</em:minVersion>
        <em:maxVersion>*</em:maxVersion>
      </Description>
   </em:targetApplication>
(While in there, you might want to change em:version to <em:version>1.2.4</em:version>.)

After that, just ZIP it up correctly & change the extension from .zip to .xpi.
("Correctly". install.rdf & all else including subdirectories should be in the topmost directory, not in a subdirectory.)

Note that there will be extraneous stuff in there, but it shouldn't matter.

If you've done that correctly, it should install & work.
(Or, you could just use the v1.0.2 version without the extra work ;-).)


(Starting at 2.0.0, they went webextension.)
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
skuwakin
Posts: 7
Joined: October 2nd, 2022, 8:34 am

Re: render JSON data prettified?

Post by skuwakin »

Good afternoon, Something on my latest seamonkey 2.53.14 the method described above did not work. Does anyone know a working option or a ready-made add-on for easy viewing of json?
User avatar
therube
Posts: 21699
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: render JSON data prettified?

Post by therube »

Just what didn't work?
Does the 1.0.2 version work?
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
skuwakin
Posts: 7
Joined: October 2nd, 2022, 8:34 am

Re: render JSON data prettified?

Post by skuwakin »

therube wrote:Just what didn't work?
Does the 1.0.2 version work?
Good day. Thanks for the answer. Now I have done a stupid experiment and went through some versions of Seamonkey. And he discovered that JsonVIIEW 1.2.4 works great to the Seamonkey version 2.53.10.2 is vkodying. In older versions, it will no longer work. Therefore, I stupidly forbade all updates and wait ... maybe they will fix it ...

p.s.
And now, in version 2.53.10.2, the correcting Fix Github has stopped working ... A little more and you will still have to leave Seamonkey ... And this oh doesn’t want to ...
User avatar
raj_bhaskar
Posts: 1946
Joined: November 7th, 2002, 3:50 am
Location: Glasgow, Scotland
Contact:

Re: render JSON data prettified?

Post by raj_bhaskar »

Have a look at JSONView 0.9 (https://github.com/bhollis/jsonview/releases/tag/v0.9) which still works for me in 2.53.14
skuwakin
Posts: 7
Joined: October 2nd, 2022, 8:34 am

Re: render JSON data prettified?

Post by skuwakin »

raj_bhaskar wrote:Have a look at JSONView 0.9 (https://github.com/bhollis/jsonview/releases/tag/v0.9) which still works for me in 2.53.14
Thanks for the answer! I could not put it. Although he transferred Install.rdf to the root, and added a section for Seamonkey. If you have XPI, then share
User avatar
therube
Posts: 21699
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: render JSON data prettified?

Post by therube »

0.9.xpi from JustOff (via ca-archive, https://github.com/JustOff/ca-archive/)
added SeaMonkey to install.rdf so that it will install in SeaMonkey:

jsonview-0.9-fx+SM.xpi: https://drive.google.com/file/d/1dDRsG2 ... sp=sharing


Does the 1.0.2 version work?
Actually, it does not.
It installs, it is there, but it does not "prettify".
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
skuwakin
Posts: 7
Joined: October 2nd, 2022, 8:34 am

Re: render JSON data prettified?

Post by skuwakin »

therube wrote:0.9.xpi from JustOff (via ca-archive, https://github.com/JustOff/ca-archive/)
added SeaMonkey to install.rdf so that it will install in SeaMonkey:

jsonview-0.9-fx+SM.xpi: https://drive.google.com/file/d/1dDRsG2 ... sp=sharing
Thank you very much for the answer and the file! But he does not even withdraw an invitation when installing. I thought, maybe I broke it something and tried to install another XPI file. Everything went regularly. I have no ideas.
Post Reply