<story><title>Analyzing multi-gigabyte JSON files locally</title><url>https://thenybble.de/posts/json-analysis/</url></story><parent_chain><item><author>jahewson</author><text>I had to parse a database backup from Firebase, which was, remarkably, a 300GB JSON file. The database is a tree rooted at a single object, which means that any tool that attempts to stream individual objects always wanted to buffer this single 300GB root object. It wasn’t enough to strip off the root either, as the really big records were arrays a couple of levels down, with a few different formats depending on the schema. For added fun our data included some JSON serialised inside strings too.&lt;p&gt;This was a few years ago and I threw every tool and language I could at it, but they were either far too slow or buffered records larger than memory, even the fancy C++ SIMD parsers did this. I eventually got something working in Go and it was impressively fast and ran on my MacBook, but we never ended up using it as another engineer just wrote a script that read the entire database from the Firebase API record-by-record throttled over several days, lol.</text></item></parent_chain><comment><author>wruza</author><text>The decision they made to store potentially multigigabyte-sized backups into a single json is just idiotic, to begin with.</text></comment>
<story><title>Analyzing multi-gigabyte JSON files locally</title><url>https://thenybble.de/posts/json-analysis/</url></story><parent_chain><item><author>jahewson</author><text>I had to parse a database backup from Firebase, which was, remarkably, a 300GB JSON file. The database is a tree rooted at a single object, which means that any tool that attempts to stream individual objects always wanted to buffer this single 300GB root object. It wasn’t enough to strip off the root either, as the really big records were arrays a couple of levels down, with a few different formats depending on the schema. For added fun our data included some JSON serialised inside strings too.&lt;p&gt;This was a few years ago and I threw every tool and language I could at it, but they were either far too slow or buffered records larger than memory, even the fancy C++ SIMD parsers did this. I eventually got something working in Go and it was impressively fast and ran on my MacBook, but we never ended up using it as another engineer just wrote a script that read the entire database from the Firebase API record-by-record throttled over several days, lol.</text></item></parent_chain><comment><author>simonw</author><text>I&amp;#x27;ve used ijson in Python for this kind of thing in the past, it&amp;#x27;s pretty effective: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;pypi.org&amp;#x2F;project&amp;#x2F;ijson&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;pypi.org&amp;#x2F;project&amp;#x2F;ijson&amp;#x2F;&lt;/a&gt;</text></comment>