Skip to content

Conversation

@PPakSang
Copy link
Contributor

@PPakSang PPakSang commented Mar 19, 2022

If you follow the docs writing custom json serializer, it throws an exception "JsonGenerationException". Of course, if there is an existing Json Generator, it is applicable code, but users (including myself) who usually follow docs are more likely to write the code first. Therefore, I think that the text should be modified as an example with the addition of JsonGenerator.writeStartObject()/writeEndObject() or a separate notice should exist for that part.

If you follow the docs writing custom json serializer, it throws  an exception "JsonGenerationException". Of course, if there is an existing Json Generator, it is applicable code, but users (including myself) who usually follow docs are more likely to write the code first. Therefore, I think that the text should be modified as an example with the addition of JsonGenerator.writeStartObject()/writeEndObject() or a separate notice should exist for that part.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 19, 2022
@snicoll
Copy link
Member

snicoll commented Mar 19, 2022

@PPakSang you are correct and that example is wrong. You can see below that is rewritten to use JsonObjectSerializer which does exactly what you've mentioned.

@snicoll snicoll added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 19, 2022
@snicoll snicoll added this to the 2.6.5 milestone Mar 19, 2022
@snicoll snicoll self-assigned this Mar 19, 2022
@snicoll snicoll modified the milestones: 2.6.5, 2.5.11 Mar 19, 2022
@snicoll snicoll changed the title Additional code for some case Fix JsonSerializer example in reference guide Mar 19, 2022
snicoll pushed a commit that referenced this pull request Mar 19, 2022
snicoll added a commit that referenced this pull request Mar 19, 2022
@snicoll snicoll closed this in 1f010a7 Mar 19, 2022
@snicoll
Copy link
Member

snicoll commented Mar 19, 2022

@PPakSang thank you for making your first contribution to Spring Boot.

@PPakSang
Copy link
Contributor Author

I was worried that I said something inaccurate because it was my first PR but it works. Thank you for the explanation. I'm really interested in Spring-boot project!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: documentation A documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants