#1268 Invalid JSON with values that begin with 0

open
KATO Kanryu
huddle (1)
5
2011-06-13
2011-06-13
Anonymous
No

I think [huddle jsondump] should quote values with a beginning zero:

::json::json2dict [huddle jsondump [huddle create key 000000]]

--> unexpected token "0" at position 5; expecting ","|"}"

::json::json2dict [huddle jsondump [huddle create key 1000000]]

--> key 1000000

PS
The category huddle is missing!

Discussion

    • labels: 705570 --> huddle
    • assigned_to: andreas_kupries --> kanryu6
     
  • KATO Kanryu
    KATO Kanryu
    2011-06-15

    >% huddle jsondump [huddle create key 000000]

    >{"key": 000000}

    this is a miss logic about huddle-lib in jsondump sub-command.

    the token '000000' should output as '0' or "000000" (string),
    but jsondump outputs as raw '000000'.

    because in huddle.tcl:455,

    > if {[string is double -strict $data]} {return $data}

    'string is double' returns 1, and the line returns raw.

    but I don't know to treat vague values strictly.

    current huddle classify only 'string' / 'list' / 'dict' only.

    for example, in jsondump, each token will be considered dynamically.

    comments?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-08-12

    Any chance this bug will be fixed?

     
  • KATO Kanryu
    KATO Kanryu
    2011-08-18

    by the way,

    according to http://yaml.org/spec/1.1/
    > Example 2.19. Integers
    >
    > canonical: 12345
    > decimal: +12,345
    > sexagesimal: 3:25:45
    > octal: 014
    > hexadecimal: 0xC

    do you think, the integer 000000 is regal?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-08-23

    I don’t know about YAML, I only know that with JSON values like this should be quoted.