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}]]]
Extended testsuite.
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.