mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Kotlin Fix JsonSerializer example in reference guide
Closes gh-30331
This commit is contained in:
parent
d8bb2ec4e0
commit
f05c19a40a
@ -34,8 +34,10 @@ class MyJsonComponent {
|
|||||||
class Serializer : JsonSerializer<MyObject>() {
|
class Serializer : JsonSerializer<MyObject>() {
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun serialize(value: MyObject, jgen: JsonGenerator, serializers: SerializerProvider) {
|
override fun serialize(value: MyObject, jgen: JsonGenerator, serializers: SerializerProvider) {
|
||||||
|
jgen.writeStartObject()
|
||||||
jgen.writeStringField("name", value.name)
|
jgen.writeStringField("name", value.name)
|
||||||
jgen.writeNumberField("age", value.age)
|
jgen.writeNumberField("age", value.age)
|
||||||
|
jgen.writeEndObject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user