简体   繁体   中英

Json files structure/format in Visual Studio Code

In Visual Studio Code (under Windows), my present Json files are displayed as the following:

在此处输入图像描述

I would them to be formatted as displayed below:

在此处输入图像描述

Use ALT-SHIFT-F to auto format a json file in windows

Press Ctrl-Shift-p to format the documents. I don't know if this shortcut works on Windows, but it does on Linux.

Install a code formatting extension then save the file.

Install Prettier using the extensions, and then right click, select format document with and pick Prettier.

Open the json file and SHIFT + OPTION + F for mac

In 2022 it's Ctrl+Shift+I as stated on the Visual Studio Code website .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM