guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-json: simple alist to json


From: Aleix Conchillo Flaqué
Subject: Re: guile-json: simple alist to json
Date: Mon, 22 Feb 2016 21:51:15 -0800


On Thu, Feb 18, 2016 at 2:21 PM, Jan Nieuwenhuizen <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]