Share via

Frustrated with JSON editing

Brandon Clark 1 Reputation point
2022-01-20T22:58:19.993+00:00

Hi gurus, I appreciate all help! I'm using Visual Studio 2019 as my editor.

I'm frustrated atm because every time I hit Enter after a line of code in a .json file it tabs the previous code in, or indents, not sure which one is happening or how to tell. Let me explain differently...

If I have a line of code like this in a .json file:

"parameters": {
 "value": "something"
 },

and I place my line cursor at the end of the 3rd line (after the comma) and press Enter, my code then gets formatted like this: (Notice it indented line 2!)

"parameters": {
          "value": "something"
 },

It's very frustrating and I've searched inside the Tools >Options> Text Editor (both general and json) and I can't find what setting is causing this.

Does anyone know?

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,836 Reputation points Microsoft External Staff
    2022-01-21T02:50:48.047+00:00

    Hello @Brandon Clark ,

    Welcome to Microsoft Q&A forum.

    Please firstly check if there is any installed third-party extension which may affect Visual Studio Text Editor.

    After that, please go to Tools > Options > Text Editor > JSON > Tabs > Indenting, and switch to Smart/Block/None then check if this fixes the issue.

    If above doesn’t work, I suggest you try to reset Visual Studio general settings from Tools > Import and Export Settings(Refer to this doc for more details).

    Feel free to contact me.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.