Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How can I configure Json serialization and deserializtion

39 views
Skip to first unread message

Sachin Mittal

unread,
Mar 7, 2025, 12:28:47 PMMar 7
to vert.x
Hello,
In our vert.x web application we are processing JSON body post request.
Hence we deserialize it into POJO, do certain transformations and again serialize into JSON.
During this step we would like to control the process like
1. Ignore unknown fields
2. Do not serialize null fields
3. Do not serialize doubles in scientific notation.

I understand that under the hood, vert.x uses Jackson, however we don't have access to ObjectMapper of Jackson directly.

Is there a way we can configure these (and possibly others what Jackson allows), during both deserialization and serialization process.

Thanks
Sachin

白石

unread,
Mar 7, 2025, 9:08:59 PMMar 7
to ve...@googlegroups.com
    ObjectMapper mapper = io.vertx.core.json.jackson.DatabindCodec.mapper();
    
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    
    mapper.registerModule(new JavaTimeModule());

Sachin Mittal <sjmi...@gmail.com> 于2025年3月8日周六 01:28写道:
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/vertx/c88f3715-872f-413e-834a-1fe5f956b4dan%40googlegroups.com.


--
wstone

Julien Viet

unread,
Mar 18, 2025, 11:49:04 AMMar 18
to ve...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages