[racket] json module bug?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue Dec 4 14:52:52 EST 2012

The documentation for jsexpr? states that JS-expressions use symbols as
keys for hash tables, and strings for all other JSON-strings.  Presumably
this is to improve the efficiency of hash table lookup.

http://docs.racket-lang.org/json/index.html

Carl Eastlund


On Tue, Dec 4, 2012 at 2:21 PM, Scott Klarenbach <scott at pointyhat.ca> wrote:

> Is this a bug with the json module, or am I missing something about the
> implementation?
>
> It seems it crashes when serializing a hashtable that has strings for
> keys.  Symbols work fine.
>
> ie,
>
> >> (jsexpr->string (hash "id" 1 "title" "core"))
> write-json: expected argument of type <bad JSON key value>
>
> BUT this works:
>
> >> (jsexpr->string (hash 'id 1 'title "core"))
> "{\"id\":1,\"title\":\"core\"}"
>
> --
> Talk to you soon,
>
> Scott Klarenbach
>
> PointyHat Software Corp.
> www.pointyhat.ca
> p 604-568-4280
> e scott at pointyhat.ca
> #308 - 55 Water St.
> Vancouver, BC V6B1A1
>
> _______________________________________
> To iterate is human; to recur, divine
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121204/362b3ab9/attachment.html>

Posted on the users mailing list.