manoj n p
manoj n p

Reputation: 11

SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not giving me the expected result

I am using below code to convert java object having DateTime varible to xml string. However I am expecting the output as 2020-08-13T16:26:00.000-05:00 but it is getting converted to 2020-08-13T16:26:00.000-05:00[-05:00].

XmlMapper xmlMapper = new XmlMapper();
xmlMapper.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL);
xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
xmlMapper.disable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
xmlMapper.enable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID);
xmlMapper.setSerializationInclusion(Include.NON_NULL);

where XmlMapper is of com.fasterxml.jackson.dataformat.xml.

Is there where I can get out as 2020-08-13T16:26:00.000-05:00 ?

Thanks.

Upvotes: 1

Views: 290

Answers (0)

Related Questions