Hi Vok, Vok Vojwo <[email protected]> writes: > I am a bit confused by the way the JSON egg maps JSON structures to > Scheme values. The JSON egg maps a structure to a vector: > > (use json) > (with-input-from-string "{\"pi\":3.14,\"e\":2.71}" json-read) > ;; => #(("pi" . 3.14) ("e" . 2.71))
I agree, this is indeed a strange choice. My guess is that there is no way to reliably detect whether a list is an alist or not. And since the json egg maps lists to JSON arrays already, "avectors" were the only choice left, it seems. You may be interested in two alternative JSON eggs, namely json-abnf egg (GPLed) which represents both JSON objects as tagged lists alists (i.e. they have a symbol `object' their car) and arrays as vectors or the medea egg (BSD licensed) which uses alists for objects and vectors for arrays by default but can be parameterized to use whatever representation you prefer. Moritz _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
