Menu

How to Render and Query a 25 MB / 60,000-Node JSON Tree in the Browser at 60 FPS
📰

How to Render and Query a 25 MB / 60,000-Node JSON Tree in the Browser at 60 FPS

DEV Community: javascript·Muhammad Ahmad·5 days ago
#Xebrhv3i
#devtojavascript#devto#dev#json#tree
Reading 0:00
15s threshold

How to Render and Query a 25 MB / 60,000-Node JSON Tree in the Browser at 60 FPS

If you have ever pasted a 10 MB JSON response into a browser-based JSON viewer and watched the tab freeze with an "Aw, Snap! Out of Memory" crash, the culprit is almost never JSON.parse() itself.

In V8, parsing 10 MB of JSON takes ~60 milliseconds. What kills the browser tab is DOM node explosion and main-thread blocking :

A 10 MB JSON payload easily contains 50,000 to 150,000 keys and array elements . Creating 3 <div> and <span> elements per node injects 300,000+ DOM nodes into the document tree, exhausting layout and style recalculation budgets.

Running syntax repair, key sorting, and search indexing on the UI thread blocks requestAnimationFrame for seconds at a time.

Here is how we architected a client-side JSON workbench that formats, repairs, queries, and renders up to 25 MB payloads at 60 FPS using Web Workers , flat tree virtualization , and a 4-stage dirty-JSON repair pipeline .

Step 1: Offloading Payloads > 256 KB…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.