Sets plus JSON

Brendan Eich brendan at mozilla.org
Thu Oct 4 17:16:09 PDT 2012


Nicholas C. Zakas wrote:
> I agree, I'm not sure there is a rational default for Map, but I think 
> there is one for Set as an array (and it seems like most people agreed).

As with Set, I claim the default JSON for Map should be

   [[key1, value1], ~~~ [keyN, valueN]]

with ~~~ as meta-ellipsis.

This is not a round-tripping seralization, any more than

   [elt1, ~~~ eltN]

is for Set. It simply is the normal form expected by the Map 
constructor. That wins.

/be


More information about the es-discuss mailing list