Pasting big JSON into the firefox webpage inspector's js console is incredibly slow

Often I will hit an endpoint which returns a lot of JSON, and I will want to fiddle around with the JSON object directly. To do this I open firefox web inspector, switch to console and paste the JSON in.

Unfortunately if I have even just a few hundred kb of json, pasting it into the firefox console will freeze the console for several minutes.

Ironically, if I use web inspector and set the body of the webpage to my JSON, and then do JSON.parse(document.body.innerHTML), then it’s lightning fast.

Likewise Chrome and Safari’s web inspectors parse the JSON lightning fast.

So I was just wondering, is there something weird going on with Firefox to make it slower? Even if someone could just point me in a direction code wise I would love to tinker and find a work around. I want to uninstall Chrome and this is the last thing preventing me from doing so.

Hello @macmee, thanks for reporting this issue.
We’ll try to check where the culprit is.
In the meantime, as a workaround, in Firefox 68 there’s a new context menu entry in the netmonitor : Use as fetch in the console.
If you click on it, it will populate the console input, and you will be able to get the JSON content quite easily.
Hope this helps, and we’ll keep you updated on the paste issue.

Here’s a link to the bug where we track the issue https://bugzilla.mozilla.org/show_bug.cgi?id=1556068

Thanks @macmee for the in-depth analysis and offer to help.

Ironically, if I use web inspector and set the body of the webpage to my JSON, and then do JSON.parse(document.body.innerHTML), then it’s lightning fast.

This is an interesting one. This shows that logging a large JSON object is fast. The slowness is in the input field. The bug Nicolas shared might be a good lead for now.

@macmee the patch landed in Nightly https://bugzilla.mozilla.org/show_bug.cgi?id=1556068#c5 . If you want to help verify, you could try it out in the next Nightly build.

@digitarald @Nicolas_Chevobbe thank you both very much! I can confirm pasting large JSON is now much faster on the nightly. You guys are awesome for replying here and fixing it so fast :grinning:!

@macmee this should be even faster thanks to https://bugzilla.mozilla.org/show_bug.cgi?id=1557305 now :slight_smile: