Set Jackson's JsonReadFeature

185 views
Skip to first unread message

Dmitriy Bykov

unread,
Mar 1, 2021, 9:49:46 AM3/1/21
to vert.x
Hi.

In my application I receive JSON data from an external service, and sometimes it contains unescaped Unicode control characters, so when I try to call a JsonObject(data) on it, I get this exception: 

Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 27)): has to be escaped using backslash to be included in string value

Since it's an external system, I can do nothing to make it response with correct JSON, but I know that Jackson can deal with it just fine if the JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS is enabled on mapper creation.

Is there an easy way to enable this option for io.vertx.core.json.* classes?

Julien Viet

unread,
Mar 5, 2021, 3:26:18 AM3/5/21
to vert.x
Hi,

yes you can do that using the json modules used by vertx.

if you are on 3, this is a static method on the Json class, otherwise you need to look at the DatabindCodec class.

Julien



--
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 on the web, visit https://groups.google.com/d/msgid/vertx/29ea1f4d-7ef7-4024-9857-bdc3005ee76cn%40googlegroups.com.

Dmitriy Bykov

unread,
Mar 5, 2021, 3:35:29 AM3/5/21
to vert.x
Thank you, I'll take a look.
Reply all
Reply to author
Forward
0 new messages