Hi, sorry for digging up this old post. This seems like not such a rare 
case. Is there a way to do it without any code (reusing existing standard 
converters) today ?
I don't care if it's [ [ k, v], [ k, v] ...] or [ { key: k, value: v}, { 
key: k, value: v},...], or even [{ myname: k, myothername: v}, { myname: k, 
myothername: v}...]
On deserialization, I don't care about what happens if the input has 
duplicates keys.

I think it's worth documenting in the main site (maybe it is and I missed 
it ?). Actually I think that relying on toString() by default to serialize 
maps<Complex,X> is surprising, and maybe it's worth adding a global option 
to objectmapper to choose to convert all the maps<ComplexTypes, X> into 
lists of key value pairs ?  

Thanks in advance,

On Thursday, June 25, 2015 at 8:41:01 PM UTC+2 [email protected] wrote:

> Right, not as well known as others. Couple of ways to use it:
>
> 1. Use of annotations, @JsonSerialize(converter=....), 
> @JsonDeserialize(converter=...) (either on type or for property)
> 2. Use StdDelegatingSerializer (instantiate, or sub-class), register via 
> module.
>
> Converters were briefly mentioned along with 2.2 release (2 years ago) at:
>
> http://www.cowtowncoder.com/blog/archives/2013/08/entry_480.html
>
> -+ Tatu +-
>
>
> On Thu, Jun 25, 2015 at 11:34 AM, Benson Margulies <[email protected]> 
> wrote:
>
>> Converters are new to me :-)
>>
>> On Thu, Jun 25, 2015 at 2:33 PM, Tatu Saloranta <[email protected]> 
>> wrote:
>>
>>> There isn't anything to do exactly that, but I think use of Converters 
>>> with intermediate type (Pair for List<Pair<K,V>>) might simplify the task. 
>>> Converter can then handle conversion from Map to List<Pair>, Jackson 
>>> serialize that using default mechanics.
>>>
>>> -+ Tatu +-
>>>
>>>
>>> On Thu, Jun 25, 2015 at 8:57 AM, Benson Margulies <[email protected]> 
>>> wrote:
>>>
>>>> Given a 
>>>>
>>>> Map<somethingcomplex, value>
>>>>
>>>> I'd rather just have it serialize as 
>>>>
>>>> [ [ k, v], [ k, v] ...]
>>>>
>>>> Is there a quick path here, or do I need a full custom setup?
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "jackson-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "jackson-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jackson-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/7cb89cd2-f7a7-44ed-9132-5784edbe1366n%40googlegroups.com.

Reply via email to