Skip to content
Advertisement

How to Serialise a JSON String to a JAVA Object using Jackson

I am having trouble in deserialising the below JSON String to a Java Object.

JavaScript

The code below should work but i think my issue is with the mapper i am passing with it –

JavaScript

The mapper i pass with it is like below :

Alert.java

JavaScript

AlertConfig.java

JavaScript

JobConfig.java

JavaScript

Error i get is :

JavaScript

I am nor sure how to name the content of alert JSON as alert but it already has been named as Alert.

Advertisement

Answer

You should create an AlertWrapper Class like below –

JavaScript

And your AlertConfig class should contain AlertWrapper like below –

JavaScript

Doing this you will complete your DTO(s)

Advertisement