Your message dated Sun, 12 Oct 2014 22:15:56 +0400
with message-id 
<caoq2pxgoqfxplxwkv8z8norf4tgrlzmanzzrperkhuq-mgo...@mail.gmail.com>
and subject line Re: Bug#764972: tcllib: json package produces incorrect json 
objects (unquoted values, nesting)
has caused the Debian Bug report #764972,
regarding tcllib: json package produces incorrect json objects (unquoted 
values,         nesting)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
764972: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764972
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: tcllib
Version: 1.14-dfsg-3
Severity: normal

Dear Maintainer,

The json package does not product proper json objects from tcl dict
objects.  Specifically:

1) The last element in the record has a trailing comma
2) The keys are quoted, but the values are not
3) Nested dict objects are not correctly nested in a json structure

Problem 1 was solved in a later teacup Windows version, but apparently
not in debian.

This script demonstrates problem 1 and 2:

=====8<----------------------------------------
#!/usr/bin/tclsh8.5

package require json

set some_address [dict create street       {sesame street}\
                              house_number 123\
                              city         bronx]

puts "[::json::dict2json $some_address]"
=====8<----------------------------------------

The erroneous output is:

  {"street": sesame street,
  "house_number": 123,
  "city": bronx,
  }

Note that the keys are quoted, but the values are not.  The values
should be quoted.  And worse, notice that the last field is followed
by a comma.

Problem 3 - broken nesting:
=====8<----------------------------------------
#!/usr/bin/tclsh8.5

package require json

set some_address [dict create street       {sesame street}\
                              house_number 123\
                              city         bronx]

# Nesting broken too:
set person [dict create name {big bird} address $some_address]

puts "[::json::dict2json $person]"
=====8<----------------------------------------

Output is:

{"name": big bird,
"address": street {sesame street} house_number 123 city bronx,
}

Note that the address field should contain another complete json
structure within it.  The 2nd and 3rd defect apparently exists in all
versions.

-- System Information:
Debian Release: 7.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tcllib depends on:
ii  tcl             8.5.0-2.1
ii  tcl8.5 [tclsh]  8.5.11-2

tcllib recommends no packages.

tcllib suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Version: 1.14-dfsg-3

Hi John!

On Sun, Oct 12, 2014 at 5:01 PM, John Kennerson <[email protected]> wrote:
>
> The json package does not product proper json objects from tcl dict
> objects.  Specifically:
>
> 1) The last element in the record has a trailing comma
> 2) The keys are quoted, but the values are not
> 3) Nested dict objects are not correctly nested in a json structure

As far as I can see looking into the json package, its purpose is to
parse JSON and not to generate it. In particular, dict2json isn't
documented, so it can have all sorts of bugs and shouldn't be used at
all. See the last comment in [1] for some explanation from the
upstream maintainer.

So, don't use json::dict2json. Use json::write package. Though, it
doesn't have one command that will take a dict and magically convert
it into JSON format. You'll have to quote strings yourself.

[1] http://core.tcl.tk/tcllib/tktview?name=1449d9f965
-- 
Sergei Golovan

--- End Message ---
_______________________________________________
Pkg-tcltk-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-tcltk-devel

Reply via email to