molsonkiko / JsonToolsNppPlugin

A Notepad++ plugin providing tools for JSON like linting, querying, a tree view, and CSV conversion.
Apache License 2.0
93 stars 10 forks source link

float values parsed wrong (SOLUTION: upgrade to latest version) #74

Closed matse02 closed 4 months ago

matse02 commented 4 months ago

origin:

{"Voltage":{"v":242.6999969,"u":"V","d":1}}

output pretty print:

{ "Voltage": { "d": 1, "u": "V", "v": 2426999969.0 } }

molsonkiko commented 4 months ago

This was an issue with an older version of JsonTools. Update to the newest version.

Sorry for the inconvenience, though!

matse02 commented 4 months ago

Thank you for your reply! I just upgraded to JsonTools V8, restarted NPP, verified via Plugins/JsonTools/About that v8 ir running , but still the same error, foatin point number have wrong deciamals, (other values and sample above used to check.)

molsonkiko commented 4 months ago

@matse02

I just upgraded to JsonTools V8, restarted NPP, verified via Plugins/JsonTools/About that v8 ir running , but still the same error, foatin point number have wrong deciamals, (other values and sample above used to check.)

Thanks for letting me know you're still experiencing the issue. This doesn't seem possible, though, because my JSON formatting code is no longer culture-sensitive, and I can verify this by setting my UI culture to one that uses , as the decimal separator (like French or German), performing your test, and not observing the issue you described, even though making that change caused the issue on older versions of JsonTools.

Could you please paste the following two things in a new comment?

  1. Your current UI culture (open PowerShell, enter the command get-culture, and paste the result)
     LCID             Name             DisplayName
    ----             ----             -----------
    1036             fr-FR            French (France)
  2. Your Debug Info (?->Debug Info... from the Notepad++ main menu)
    Notepad++ v8.6.9   (64-bit)
    Build time : Jul 12 2024 - 05:09:25
    Path : C:\Program Files\Notepad++\notepad++.exe
    Command Line : 
    Admin mode : OFF
    Local Conf mode : OFF
    Cloud Config : OFF
    Periodic Backup : ON
    OS Name : Windows 10 Home (64-bit)
    OS Version : 22H2
    OS Build : 19045.4651
    Current ANSI codepage : 1252
    Plugins : 
        ColumnsPlusPlus (1.1.1)
        ComparePlus (1.1)
        CSharpPluginPack (0.0.3.8)
        CSVLint (0.4.6.6)
        EnhanceAnyLexer (1.1.3)
        HTMLTag (1.4.3.1)
        HugeFiles (0.4.1)
        JsonTools (8.0.0.13)
        mimeTools (3.1)
        NavigateTo (2.7)
        NppConverter (4.6)
        NppExport (0.4)
        NppLspClient (0.0.21)
        PythonScript (3.0.16)
        XMLTools (3.1.1.13)
  3. The result of pretty-printing {"Voltage":{"v":242.6999969,"u":"V","d":1}} using JsonTools v8. Assuming indent_pretty_print = 4, sort_keys = False, tab_indent_pretty_print = False, and pretty_print_style = Google, it should be
    {
        "Voltage": {
            "v": 242.6999969,
            "u": "V",
            "d": 1
        }
    }
  4. The result of compressing {"Voltage":{"v":242.6999969,"u":"V","d":1}} using JsonTools v8. Assuming sort_keys = False and minimal_whitespace_compression = True, this should be {"Voltage":{"v":242.6999969,"u":"V","d":1}}