Turn off auto formatting for json files in Visual Studio Code

I have checked my preference multiple times and ensured that all options related to format-on-save are set to false. And yet everytime I save a .json file I see my file getting formatted.


Solution 1:

EDIT: Uninstall the extension, there are many other far better maintained formatters out there (e.g. Beautify)

OK, check if you have installed this extension: "JS-CSS-HTML formatter".

Now if you have, press CTRL+SHIFT+P, type "Formatter" and you should see an option that says Formatter Config.

After selecting that option, a file named formatter.json opens and all you do is edit the property (named onSave) from having true to being false.

Restart vs code and voilà!! It stopped auto formatting. (yay!!!!)

Solution 2:

In Visual Studio Code, in order to stop autoformatting only for your json files add the following in settings.json file by opening User Settings - Preferences.

{   
    "[json]": {
        "editor.formatOnSave": false   
    }
}

Solution 3:

I am using the below version of VS Code

Version: 1.28.2 (user setup)
Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
Date: 2018-10-17T00:23:51.859Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

And turned it off with the following steps:

  1. CTRL+SHIFT+P
  2. Type Settings
  3. Select Preferences: Open User Settings

Now follow these image instructions:

Click Edit in settings.json Change shown user setting values

  1. Select Save All
  2. Restart VS Code

Solution 4:

In VS Code by default Save without Formatting is done by -

on Windows :
STEP 1 : Press CTRL + K then
STEP 2 : Press CTRL + Shift + S

on MAC :
STEP 1 : Press CMD + K then
STEP 2 : Press S