Sets plus JSON

Axel Rauschmayer axel at rauschma.de
Wed Oct 3 12:14:00 PDT 2012


Another reviver-friendly possibility: type tags for objects (arrays remain as they are).

[
    { "__type__": "Date", "time": 1349291353269 },
    { "__type__": "Object", "first": "Jane", "last": "Doe" },
    { "__type__": "Map", "entries": [ ["first", "Jane"], ["last", "Doe"] ] }
]

This assumes that the keys of objects are known beforehand (to avoid a key from clashing with "__type__"). Keys of maps can be arbitrary, even type-tagged objects.

On Oct 3, 2012, at 20:49 , Brandon Benvie <brandon at brandonbenvie.com> wrote:

> Taking a cue from plist, which is easily transformed to and from JSON, you would end up with something like
> [{ key: {...key..}, value: {...value...} }]
> which is less space efficient but pretty easy to automatically convert back to a map (aside from correctly handling duplicate values).
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121003/3357b4d0/attachment.html>


More information about the es-discuss mailing list