Spring Boot Endpoint returning both XML AND JSON with Jackson

preview_player
Показать описание
Use Jackson to control the xml output and set the list wrapper with annotations.

Enjoy! :-)
Thank you for commenting and asking questions.

The code is located here:
Follow me on twitter:
Support me on Patreon:

As an Amazon Associate I earn from qualifying purchases.
Check out the stuff that I like (always updated):
Рекомендации по теме
Комментарии
Автор

Amazing support and feedback. Thank you so much!

SpookHam
Автор

Your videos have really helped me a lot and inspired me. When the day comes, I will also make a YouTube page like you, to teach other people what I know =)

SpookHam
Автор

How do I get rid of the default prefix being prepended when I am using namespaces? `wstxns` is added before the name of the namespace.

bahali
Автор

@JacksonXmlElementWrapper to indicate wrapper name to use for a Collection type

AmNotLegend
Автор

I was thinking of using recursion for this, so when user gives me some XML file or string I would use my function which would allow me to visit all data presented by user and automatically (as function is reading it) switch it in JSON format (or I would just create a new file/string with all data needed to make conversion to JSON and then convert it to JSON by applying those rules before mentioned). Same would be done for JSON file or string input. Is this possible, and how would you suggest me to approach this problem? Could you make video on that or something, would be really thankful. Also I've spent bunch of time on internet trying to find acceptable solution for this, but sadly wasn't able to do so. Thanks in advance :D

diedrich
Автор

Thank you Mike, for this Video. This has provided solution to me after putting a lot of effort on this conversion part. however still looking for an answer, where coolSpaceship is part of other element as well. Here I am getting conflicts with reference variable in POJO, just checking if we have any alternative way. Below is sample.

<SpaceStation>

<spaceshipList>
<coolSpaceship>
<name>x</name>
</coolSpaceship>

<coolSpaceship>
<name>y</name>
</coolSpaceship>

<coolSpaceship>
<name>z</name>
</coolSpaceship>

</spaceshipList>

<spaceshipDetails>

<coolSpaceship>
<name>A</name>
</coolSpaceship>

<coolSpaceship>
<name>B</name>
</coolSpaceship>

<coolSpaceship>
<name>C</name>
</coolSpaceship>

</spaceshipDetails>

</SpaceStation>

developertalk
Автор

everybody is showing @getmapping method.I need to learn @postmapping and @putmapping but I couldnt find it :(

sesi
welcome to shbcf.ru