On Thu, Feb 18, 2016 at 2:21 PM, Jan Nieuwenhuizen <jann...@gnu.org> wrote:

> Hi Aleix,
>
> Attached are two patches to allow converting simple alists
> to json, this removes the need for strings or hash-tables
>
>     scheme@(json)> (scm->json-string '((a . 1) (b . 2)))
>     $2 = "{\"a\" : 1,\"b\" : 2}"
>
>
​
Hi Jan,

thanks for the patch! I have tried with guile 2.0.11 and it's giving me th
​e error at the end. I had zero time to fix it, but I believe it's
complaining because of this:

scheme@(guile-user)> (symbol 'a)
ERROR: In procedure string:
ERROR: In procedure string: Wrong type (expecting character): a

​"a" is already a symbol.

Best,​

​Aleix
​

scheme@(guile-user)> (use-modules (json))
scheme@(guile-user)> (scm->json-string '((a . 1) (b . 2)))
ERROR: In procedure string:
ERROR: In procedure string: Wrong type (expecting character): a

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
           4 (call-with-output-string #<procedure 1975db0 at
json/builder.scm:196:3 (p)>)
In json/builder.scm:
    173:4  3 (json-build ((a . 1) (b . 2)) #<output: string 195eb60> #f #f
0)
   118:34  2 (json-alist? ((a . 1) (b . 2)))
In ice-9/boot-9.scm:
  1423:18  1 (symbol a)
In unknown file:
           0 (string a)

Reply via email to