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 <sc...@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 sc...@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
>
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to