polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: ZEST-23
Date Thu, 21 May 2015 08:37:10 GMT
I have been looking at this issue and I wonder if there are any notes from
the original implementation...

For instance, a regular Map is serialized to
map: [
    { "key" : "FirstName", "value" : "Niclas" },
    { "key" : "LastName", "value" : "Hedhman" }
]
but it could have been made;

map : {
    "FirstName" : "Niclas",
    "LastName" : "Hedhman"
}

My guess is that there is "schema" reasons for this. Also, it is not
something that can now be changed, at least not without adding built-in
handing of old format (which is a possibility).

One of the usecases of this outside of the storage, would be using this
serialization SPI for the toValue() and toEntity() methods, in which case
the serialization would end up being processable in JavaScript.

So, in that case, would it makes more sense to have "key"/"value", or to
have Maps showing up as objects?? I am not that fluent in JavaScript to
have an opinion. I can imagine that having the second/object form, is neat
when one knows what is coming over the wire, but could messy to iterate as
built-in attributes need to be filtered out. Or?


// Niclas

On Thu, May 21, 2015 at 7:55 AM, Niclas Hedhman <niclas@hedhman.org> wrote:

> Jiri,
> thanks for your analysis of why it breaks.
>
> I assume that a JSON Object for NamedAssociation is the correct path
> forward,
>
> {
>     "left" : "723470239476",
>     "right" : "109874275692"
> }
>
> instead of the JSON Array which needs inner objects in that case,
>
> [
>     { "left" : "723470239476" },
>     { "right" : "109874275692" }
> ]
>
> Paul, your thoughts?
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message