There are number of extensions in Visual Studio Code (VS Code) to prettify JSON files. But is there an extension or setting, which enables me to view all *.json files pre-formatted / pre prettified? I find it tedious to constantly press shift-alt-F + ctrl-s when viewing ugly one line json-data, especially if the content of the file is being updated regularly back to pre-formatted form.
Is there a way to view JSON files automatically prettyfied in Visual Studio Code?
Asked Answered
On Windows: Shift + Alt + F
On Mac: Shift + Option + F
On Linux: Ctrl + Shift + I
Original answer How do you format code in Visual Studio Code (VSCode)?
I'm adding it here because when I was looking for it I found your post before the other one. Hope it helps.
The ideal solution to the original question would not involve pressing any key combos. Nonetheless thanks for leaving this documenting answer! –
Musette
I get there is not formateer for binary text file installed message –
Moidore
I've made this and was requested to add a formatter. A side window opened, where I've placed
category:formatters plaintext prettier
. So, I installed Prettier
. Next time I've pressed the combo keys I was required to setup the default formatter. And that's it. –
Alkane Be aware that if you have the setting
JSON > format: Keep Lines
enabled (the default is disabled), that a one-liner JSON file (or any JSON that has multiple key/values on the same line) will not be formatted as you wish. The file might not change at all until you disable the Keep Lines
setting and re-format.
"json.format.keepLines": false
–
Middle You can download JsonPrettifier extension.
Unless this automatically format the file upon opening, it does not answer the original question –
Musette
you can dowlnoad JSON from Meezilla extension and then Press Cmd/Ctrl+Shift+J to quick beautify with default config.
© 2022 - 2024 — McMap. All rights reserved.