chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] [announce] JSON egg version 2.0


From: Daishi Kato
Subject: Re: [Chicken-users] [announce] JSON egg version 2.0
Date: Tue, 13 Feb 2007 09:53:59 +0900

Hi, sorry for the delay.

Here is an example that breaks inconsistency.
I don't think I'm happy with this.

#;18> (with-output-to-string (lambda () (json-write
(with-input-from-string "[[\"a\",1,2]]" json-read))))
"{\"a\" : [1, 2]}"

Daishi

On 2/10/07, John Cowan <address@hidden> wrote:
Daishi Kato scripsit:

> >2) An a-list (list of pairs) will be written as a JSON object
> >(structure).
> >Likewise, a vector containing writable objects rather than pairs will
> >be written as a JSON list.  (However, an empty Scheme list is written as
> >a JSON list, whereas an empty Scheme vector is written as a JSON
> >object.)
>
> So, it's the opposite from the original version, isn't it?
> This looks like a better rule, but please let me know if there is any
> reason for it.

No.  In Version 1, a Scheme list was always written as a JSON list
(and signaled an error if the components were pairs), whereas a Scheme
vector was always written as an JSON object (and signaled an error if
the components were *not* pairs).

In Version 2, there is no difference between (non-empty) lists and
vectors: it's all about whether the components are pairs (write an object)
or not (write a list).

--
John Cowan  address@hidden  http://ccil.org/~cowan
And now here I was, in a country where a right to say how the country should
be governed was restricted to six persons in each thousand of its population.
For the nine hundred and ninety-four to express dissatisfaction with the
regnant system and propose to change it, would have made the whole six
shudder as one man, it would have been so disloyal, so dishonorable, such
putrid black treason.  --Mark Twain's Connecticut Yankee





reply via email to

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