0

I made vo like this and sent it as a response body, but it was displayed in lowercase

Java Spring

@Data
public class VO {
    private Legend legend = new Legend();
    private XAxis xAxis = new XAxis();
    private YAxis yAxis = new YAxis();

Response Json Body

...
xaxis : "..."
yaxis : "..."
...

So after googling, I made the following using JsonProperty annotation.

Java Spring

@Data
public class VO {
    private Legend legend = new Legend();
    @JsonProperty("xAxis")
    private XAxis xAxis = new XAxis();
    @JsonProperty("yAxis")
    private YAxis yAxis = new YAxis();

But the result of this is that two xAxis are created.

Response Json Body

xaxis : "..."
xAxis : "..."
yAxis : "..."

The curious thing is that only one yAxis was made.

can i know the reason? And do you know how to solve it? I only have to send one xAxis, one yAxis

SY Yu
  • 1
  • 1
  • Refer this for some suggestions: [How to return JSON response in Springboot?](https://stackoverflow.com/questions/64735088/how-to-return-json-response-in-springboot). – prasad_ Jun 22 '23 at 05:28
  • Take a look at the `ObjectMapper` configuration. There might be a property naming scheme configured somewhere. – Jorn Jun 22 '23 at 07:01

0 Answers0