On Sep 21, 2015, at 1:08 PM, Ludovic Courtès <ludo@gnu.org> wrote:

David Thompson <davet@gnu.org> skribis:

JSON is an commonly encountered format when writing web applications,
much like XML, and I think it would be a good idea if the core Guile
distribution had an SXML equivalent for JSON.  This patch introduces
such an interface in the (ice-9 json) module.

There’s also guile-json, bindings to a C library, but I think it’s
better to have a pure Scheme implementation, and to have it in Guile
core.

I wonder if we should introduce it in 2.0.  What do people think?


I would be happy to have this in the core; I have used it.  A few comments:

1. There is a minor typo in the source: should be "denominator.”
2. The comments say integers are converted to exact and floating point to inexact, but the code will convert 1.0 to exact.

Would it work to use the parser from (language ecmascript parse),
possibly restricting it?  Or do you think it’s more viable to have a
separate parser because there are too many differences?

I vote for separate parser, the json.scm file is lightweight.  json.scm.go is < 17k.