HookyQR / VSCodeBeautify

Enable js-beautify (https://github.com/beautify-web/js-beautify) in VS Code
MIT License
607 stars 178 forks source link

Beautify removing some keys from objects in array #413

Open pecampelo opened 1 year ago

pecampelo commented 1 year ago

I do not make use of any .editorconfig or jsbeautifyrc files nor language-specific settings.

Action performed

I tried to beautify a JSON file with 2 spaces and keep command:

It was supposed to look like this, which I was able to do using Prettify instead:

[
  {
    "movie": "Ghostbusters",
    "status": "deleted",
    "inserted_at": "2022-10-04T20:38:00",
    "timestamp": "2021-11-10T03:00:00Z",
    "updated_at": "2022-10-18T20:04:00",
    "deleted_at": "2022-10-18T20:05:00",
  },
  {
    "movie": "Ghostbusters 2",
    "status": "active",
    "inserted_at": "2022-10-04T23:38:00",
    "timestamp": "2021-11-10T04:00:00Z",
    "updated_at": "2022-10-18T21:03:00",
    "deleted_at": null,
  }
]

Using Beautify:

[
  {
    "movie": "Ghostbusters",
    "inserted_at": "2022-10-04T20:38:00",
    "timestamp": "2021-11-10T03:00:00Z",
  },
  {
    "movie": "Ghostbusters 2",
    "inserted_at": "2022-10-04T23:38:00",
    "timestamp": "2021-11-10T04:00:00Z",
    "updated_at": "2022-10-18T21:03:00"
  }
]

Basically, it removed some keys from the .json file. Specifically, the status and deleted_at fields. Maybe it has something to do with the fields being a standard for the package?