From 8536100009c8f9602ef211246c7c32cd2561af19 Mon Sep 17 00:00:00 2001 From: SangHyun-Park <51109514+PPakSang@users.noreply.github.com> Date: Sat, 19 Mar 2022 15:56:49 +0900 Subject: [PATCH] Fix JsonSerializer example in reference guide See gh-30329 --- .../springmvc/json/MyJsonComponent.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/json/MyJsonComponent.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/json/MyJsonComponent.java index 44fea4b648..e0e232a027 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/json/MyJsonComponent.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/json/MyJsonComponent.java @@ -37,8 +37,10 @@ public class MyJsonComponent { @Override public void serialize(MyObject value, JsonGenerator jgen, SerializerProvider serializers) throws IOException { + jgen.writeStartObject(); jgen.writeStringField("name", value.getName()); jgen.writeNumberField("age", value.getAge()); + jgen.writeEndObject(); } }