VisualStudio icon indicating copy to clipboard operation
VisualStudio copied to clipboard

VS 2019 - Formats JSON into a single line.

Open lugospod opened this issue 5 years ago • 2 comments

Microsoft Visual Studio Community 2019 Version 16.7.7

What happened

When pasting or formatting JSON file with CTRL+K+D, VS formats/flattens the JSON into a single line.

Steps to Reproduce

  1. Copy JSON
  2. CTRL+V in Visual studio (file extension is .json)
  3. Result: only one line in file (no break lines)

Expected behavior

JSON formatted with \n\r

Screenshots

Visual studio JSON settings: image image

Logs

Visual studio info export VisualStudioInfo.txt

Visual studio ActicityLog.xml ActivityLog.zip

lugospod avatar Oct 31 '20 07:10 lugospod

Anyone?

lugospod avatar Jun 07 '21 06:06 lugospod

The Brace positions setting "Compact" is the cause, set it to "Semi-expanded" to get your usual format. Sadly I don't know how to keep arrays in a single line while having normal newline behavior for the rest of the JSON.

Ryuichiro avatar Jun 14 '21 14:06 Ryuichiro