Tk Library Source Code

View Ticket
Login
Ticket UUID: 3428262
Title: JSON: Trailing spaces added to number value
Type: Bug Version: None
Submitter: Created on: 2011-10-25 14:00:51
Subsystem: json Assigned To: andreas_kupries
Priority: 5 Medium Severity: Minor
Status: Deleted Last Modified: 2013-05-31 19:25:02
Resolution: Not Applicable Here Closed By: aku
    Closed on: 2013-05-31 19:25:02
Description:
When the source json is { "a" : 0 }, then the resulting dict is: { a {0 } } (not {a 0}). This may be significant when comparing json results coming from two different sources.

To fix this problem, please change near this line:
string is double -failindex last $txt
the following line:
set num [string range $txt 0 [expr {$last - 1}]]
into:
set num [string trim [string range $txt 0 [expr {$last - 1}]]]
User Comments: andreas_kupries added on 2011-11-11 05:53:09:
The newly attached file is an extended testsuite where I tried to reproduce the reported problem. See the test cases 3.0 to 3.2 at the bottom.

Sadly these tests all pass (*), so I was not successful.
Is it possible for you to attach a script which reproduces the issue exactly ?
That way I can not only see the problem you have, but also have a piece of code ready to become a test case.

~~~~~~~~~~~~~~~~~~~~
(*) I used Tcl 8.5 head (8.5.11+), and Tcl 8.6 head (8.6b2+) from the core source repository.

andreas_kupries added on 2011-11-11 05:49:21:

File Added - 428212: json.test

Attachments: