There are number of extensions in Visual Studio Code (VS Code) to prettify JSON files. But is there an extension or setting, which enables me to view all *.json files pre-formatted / pre prettified? I find it tedious to constantly press shift-alt-F + ctrl-s when viewing ugly one line json-data, especially if the content of the file is being updated regularly back to pre-formatted form.
            Asked
            
        
        
            Active
            
        
            Viewed 1.9k times
        
    3 Answers
37
            
            
        On Windows:    Shift + Alt + F  
On Mac:        Shift + Option + F  
On Linux:      Ctrl + Shift + I  
Original answer How do you format code in Visual Studio Code (VSCode)?
I'm adding it here because when I was looking for it I found your post before the other one. Hope it helps.
 
    
    
        manuelbcd
        
- 3,106
- 1
- 26
- 39
- 
                    1The ideal solution to the original question would not involve pressing any key combos. Nonetheless thanks for leaving this documenting answer! – Kamaradski Jun 16 '23 at 13:11
2
            
            
        You can download JsonPrettifier extension.
 
    
    
        humblecoder
        
- 25
- 2
- 
                    1Unless this automatically format the file upon opening, it does not answer the original question – Kamaradski Jun 16 '23 at 13:09
0
            
            
        Be aware that if you have the setting
JSON > format: Keep Lines
enabled (the default is disabled), that a one-liner JSON file (or any JSON that has multiple key/values on the same line) will not be formatted as you wish.  The file might not change at all until you disable the Keep Lines setting and re-format.
 
    
    
        Mark
        
- 143,421
- 24
- 428
- 436
