Why VS Code freezes on large JSON files
VS Code hangs, lags or spikes your CPU the moment you open a big .json file. Here's
what it's doing under the hood — and how to view multi-gigabyte JSON instantly instead.
VS Code is a great editor, but it was built to edit source code — files measured in kilobytes, not gigabytes. Open a large JSON export and it can stall for a minute, peg a CPU core, or run out of memory and reload the window.
What VS Code is actually doing
When you open a JSON file, VS Code does several things at once, and each scales badly with size:
- Loads the whole file into an in-memory editor model so every character is editable — memory grows with the file.
- Tokenizes and syntax-highlights the document. Above a size threshold VS Code enables "large file optimizations" and disables tokenization — which is why highlighting suddenly stops.
- Runs the built-in JSON language service, which parses the document to provide folding, validation, the outline and IntelliSense — a full parse that blocks on a large file.
- Format-on-open, bracket-pair colorization and the minimap each add another pass over the whole document.
On a 20 MB file you'll feel the lag; at a few hundred MB the language service or formatter can hang the window; past that VS Code hits its memory limit and gives up.
Settings that help a little
If your file is only moderately large (tens of MB), a few settings buy headroom:
"editor.largeFileOptimizations": true— on by default; stops VS Code tokenizing very large files.- Raise
"files.maxMemoryForLargeFilesMB"if you have RAM to spare. - Turn off
"editor.formatOnSave"and"editor.bracketPairColorization.enabled". - Set the file's language to Plain Text to bypass the JSON language service — though you lose folding and validation.
These help at the margins. None of them make VS Code a good way to read a multi-gigabyte file, because the core problem — parsing the whole document into memory — remains.
The native fix: don't parse the whole file
To open a large JSON file instantly, you need a tool that streams it instead of loading it. Pandia is a free, native desktop app that does exactly that: at 10 MB and up it uses lazy, zero-copy slicing and only loads the slice on screen, so a multi-gigabyte file opens with no lag and no memory blow-up. And because it's a JSON tool first, you get a real tree, a spreadsheet-style Grid, whole-document search and validation — the things VS Code's text model can't give you on a huge file.
- Download Pandia for Mac, Windows or Linux.
- Drag the JSON file in — it opens immediately, whatever the size.
- Navigate the tree, search the whole document, and filter arrays in the Grid.
When to use which
| Task | VS Code | Pandia |
|---|---|---|
| Editing code & small config | Best | — |
| Opening a multi-GB JSON file | Freezes / crashes | Opens instantly |
| Tree, Grid & graph views | No | Yes |
| Search on a huge document | Slow | Whole-document |
| Offline & no upload | Yes | Yes |
Keep VS Code for editing code and small config files; reach for a native JSON viewer the moment a file is too big to open comfortably.
Frequently asked questions
Why does VS Code freeze when I open a large JSON file?
It loads the whole file into an editable in-memory model and runs its JSON language service, formatter and highlighter over the entire document. Each pass scales with file size, so a large file stalls the window.
What size JSON can VS Code handle?
Comfortably, a few megabytes. Tens of MB get laggy; a few hundred MB can hang the JSON language service or exhaust memory. For anything larger, use a streaming native viewer.
How do I open a large JSON file that VS Code can't?
Open it in Pandia, a native app that streams the file instead of parsing it up front. There's no cap on opening or viewing, and nothing is uploaded.
Is there a VS Code extension for large JSON?
Extensions run inside the same editor model, so they inherit the same memory and parsing limits. A separate native viewer sidesteps the problem rather than working around it.