aconchillo / guile-json

JSON module for Guile
GNU General Public License v3.0
100 stars 34 forks source link

Cannot write the empty object #47

Closed civodul closed 5 years ago

civodul commented 5 years ago

Hello!

In version 3.1.0, (json-string->scm "{}") returns the empty list, but (scm->json-string '()) raises an error. So it seems we cannot emit the empty object currently, right?

Thanks, Ludo'.

civodul commented 5 years ago

The fix is to change json-build so that the condition (pair? scm) becomes (or (pair? scm) (null? scm)), or simply (list? scm) (which is O(N), though).

ZelphirKaltstahl commented 5 years ago

I believe this is fixed in https://github.com/aconchillo/guile-json/pull/46/commits/68ade9d55ae637475658546ec80a8cd27d24c728 or https://github.com/aconchillo/guile-json/pull/46 already.

aconchillo commented 5 years ago

Hi! Yes, that's fixed in that commit. I will cut a release.

aconchillo commented 5 years ago

The fix is now available in version 3.2.0.