jackson - map json string or json array to String in java object

I have a json created by elixir class which has a field which can be string or array

field :logs, {:array, :string}

If anyone don't get this it will be like

{"logs" : "some log 1"}

or

{
"logs": ["some log 1", "some log 2"]
}

for which I have a java field mapped

@JsonProperty("logs")
private String logs;

This mapping works only when the logs comes as a String but fails if the logs comes as array with error saying it will not be able to convert START_ARRAY to string

How to serialize the field if it comes as array and store it as a comma separated string

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum