How to format json in javascript file in Visual studio code when formatOnSave is true?

var obj = {
  name: "xyz",
  routes: {
    "": "showView1",
    "view2": "showView2",
    "view3": "showView3"
  }
}

If I save this code in a .js file in vscode automatically my json object property double quotes are removed , like below

var obj = {
  name: "xyz",
  routes: {
    "": "showView1",
    view2: "showView2",
    view3: "showView3"
  }
}

The code is perfectly working fine in .JSON file. What are the setting that I need to change to save my code as it is without voiding double quotes when saved?

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.