"Format Document" Command Doesn't Format Json

I have a JSON document opened in Visual Studio Community 2017 on Windows 10. I am trying to format the document using the "Format Document" command (Ctrl+K,Ctrl+D). When I do that I get the following message:

The key combination (Ctrl+K, Ctrl+D) is bound to command (Format Document) which is not currently... (Cant find the rest of the sentence)

How to solve this?

1 Answer

This is a known problem listed at
JSON formatting is broken when using all TAB indents, nested objects and arrays all inside a file.

A known workaround is to replace tabs by spaces. Enter the menu Tools > Options > Text Editor > JSON > Tabs, and enable "Insert spaces".

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest