chrismeyers / vscode-pretty-json

Visual Studio Code extension that provides commands to format JSON
https://marketplace.visualstudio.com/items?itemName=chrismeyers.vscode-pretty-json
MIT License
0 stars 0 forks source link

prettify converts decimals to int #2

Open skeletorkun opened 5 months ago

skeletorkun commented 5 months ago

before :

{"driving":8.0,"stopover":8.0,"trip":8.0}

after

{
    "driving": 8,
    "stopover": 8,
    "trip": 8
}
chrismeyers commented 5 months ago

It looks like this is just the nature of how JSON.stringify / JSON.parse work. Using non-zero floating point values such as {"driving":8.1,"stopover":8.2,"trip":8.3} result in the expected output of:

{
  "driving": 8.1,
  "stopover": 8.2,
  "trip": 8.3
}

The only other thing I can think of is storing the data as a string, like {"driving":"8.0","stopover":"8.0","trip":"8.0"}.