emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] json: Add support for encoding structs


From: Stefan Monnier
Subject: Re: [PATCH] json: Add support for encoding structs
Date: Wed, 26 Apr 2017 08:13:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> Maybe one way is to distinguish '(:serialize-field nil) from '() by
> checking with memq for the key?

FWIW, while you can make this work, I think it's a bad API: Elisp
usually behaves like "an absent argument is equivalent to nil", and it's
easier for the coder if we stick to this behavior (also, occasionally
it's handy to be able to use ":key nil" in order not to pass :key).

> IIRC, the empty string is a valid JSON key (`JSON.parse(`{"":1}`)`
> works in JS).  Symbols are also considered a valid type according to
> `json-encode-key'.

I don't see why that forces us to also accept symbols here.


        Stefan




reply via email to

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