jsonvisual-studio-codeformattingfilesize

VSCode: File is too large for tokenization / formatting


I have an 800kb *.json file all condensed into one line.

The built-in JSON formatter seems to refuse to format and tokenize the file and after searching for a while I haven't found any solutions. How can I do this?


Solution

  • I needed to format ~90MB json file. Initially Vscode was stubborn, but I found a workaround.

    Open JSON file and 'save as' it under any name. Somehow this triggers something and it then becomes recognised as JSON file. Then you can use 'Format Document'.

    Beawere, first time it crashed Vscode because process was suspended. Had to close and start over, just this time I set the priority on Vscode process to high and then it ran fast and quite smoothly.

    My PC has 24GB ram, Vscode was using about 7.