How can I format JSON document in Visual Studio Community 2019?

I tried Ctrl + K, Ctrl + D, but it only works for *.cs files. JSON file has no errors and it isn't big, but when I press Ctrl + K, Ctrl + D it says the command is unavailable. I tried some other combos that I've found in the internet but they don't work at all. I also don't have text editor options for JSON. Do I have to install something additionally for them to appear?

I have Visual Studio Community 2019 16.4.4 and Windows 10 x64.


Solution 1:

If I understood your question, Ctrl+A, Ctrl+K+F works for me.

Before formatting:
before formatting

After formatting:
after formatting

Solution 2:

You could copy your code into a blank JSON file using the menus. I'm using Microsoft Visual Studio Community 2019 Version 16.8.5.

File -->New-->File-->Web-->JSON File

enter image description here

enter image description here

Then you can right click and choose Format Document.

enter image description here

Solution 3:

None of the above worked for me.

Instead

ALT + SHIFT + F

did the job!