Sets plus JSON

Rick Waldron waldron.rick at gmail.com
Wed Oct 3 11:30:38 PDT 2012


On Wed, Oct 3, 2012 at 2:21 PM, Herby Vojčík <herby at mailbox.sk> wrote:

>
>
>
>>
>> Of course, but again, I'm not sure how either of those would help
>> identify which:
>>
>> '{ "foo": [1,2,3,4,5], "bar": [1,2,3,4,5] }'
>>
>> ...Is the Array and which is the Set
>>
>> Maybe I'm still misunderstanding? If I am, I apologize
>>
>
> The idea is that set is replaced with something like
>         { "this is an instance of Set": Array.from(aSet) }
> and in the way back it is converted back to set again.
> (so not a plain array, it is then not distiguishable, of course)
> (similarly for maps etc.)
>
> The problem is choosing how to transform there and back so it does not
> clash. If clash is avoided, using proper replacer in JSON.stringify and its
> counterpart in JSON.parse more-or-less-transparently JSON-encodes and
> -decodes sets.
>
>
Ok, that's what I thought you meant and yes, I agree that is a task for
library code

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


More information about the es-discuss mailing list