Ok, but how does Jackson know which custom mapper to call if we are simply 
putting obj.getFirstProperty() in the response map? I know need one value 
and would want the serializer to ignore all other properties regardless 
whether they have been initialized with default values.


On Tuesday, May 21, 2019 at 2:40:27 PM UTC-4, Tatu Saloranta wrote:
>
> Just one question:
>
>  
>
>>         responseBody.put("firstProperty", 
>> serializeFirstProperty(obj.getFirstProperty()));
>>         responseBody.put("secondProperty", 
>> serializeSecondProperty(obj.getSecondProperty()));
>>         responseBody.put("thirdProperty", 
>> serializeThirdProperty(obj.getThirdProperty()));
>>
>
> Why do you serialize values? That is where "double-escaping" comes: you 
> are adding JSON String within content to be JSON serialized. Just add 
> values as is
>
>    responseBody.put("firstProperty", obj.getFirstProperty());
>
> and contents would get serialized just once. 
>
> -+ Tatu +-
>
>
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/e9420cec-0ddb-4af4-bfc7-1383bede4920%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to