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?
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?
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.
First, you need to have JSON extension installed in VS Code.
You need to increase the maximum number of outline symbols and folding regions computed.
Go to Settings -> input json.maxItemsComputed
in the search bar -> increase the number from 5000 to any number you need.
Based on another SO thread, you can use a simple python command to format large JSON files
cat ugly.json | python -m json.tool > pretty.json
© 2022 - 2024 — McMap. All rights reserved.