micronaut-core
micronaut-core copied to clipboard
@JsonFormat not working for @Emeddable class
Expected Behavior
For the following class I expect openTime
and closeTime
to serialize as "HH:mm"
.
@Embeddable
@Introspected
data class Hours(
var dayOfWeek: DayOfWeek,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
var openTime: LocalTime,
@JsonFormat(pattern = "HH:mm")
var closeTime: LocalTime,
var closed: Boolean = false,
var alwaysOpen: Boolean = false
)
Actual Behaviour
However it serializes to something like [9,0]
like the JsonFormat is completely ignored. I've tried the following with no luck
- Adding
@Introspected
- Removing
shape = JsonFormat.Shape.STRING
- Looked through previous issues
Steps To Reproduce
I have the following installed in build.gradle
implementation("io.micronaut:micronaut-jackson-databind")
implementation("com.fasterxml.jackson.core:jackson-databind")
runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
Environment Information
macOS 12.6.7 jdk 17
Example Application
No response
Version
3.9.4