daemon54
daemon54

Reputation: 1105

Bad translation of value for YAML processor (Jackson, SnakeYAML) in Spring Boot

I'm trying to read from a YAML properties file in my spring boot application. Here's the content from the file,

KEY1:
   KEY2:
     VAL1: 08:00:00
   KEY3:
     VAL2: 16:00:00

When I get the value from the YAML processor, The value is translated as 57600 for KEY1.KEY3.VAL2.

Only If I make the value as 09:00:00, Anything lesser than 10:00:00, It's working. KEY1.KEY2.VAL1 gives the proper value Since its lesser than 10:00:00.

Note: The values here correspond to a particular point in time in a day.

Upvotes: 0

Views: 149

Answers (1)

Mansur
Mansur

Reputation: 1829

Put double quotes around values so that they will be forced to be mapped as String. Like so:

KEY1:
   KEY2:
     VAL1: "08:00:00"
   KEY3:
     VAL2: "16:00:00"

Upvotes: 2

Related Questions