The property name of the returned front page is inconsistent with the name of the entity class. Use @JsonProperty

Scenario: For example, the front end requires you to return a json data type, but the value of some attributes in this json type is repeated, such as

{
    name:zhangsan,
    age:12,
    teacher:[
        name:Mrs Liu
        subject:math
    ]
}

Like this, there are two names, but the front end is required to pass it like this. It ’s very painful. Both are names. I do n’t know what it means after a long time, so we have to solve it.

@JsonProperty("name")
private String teacherName;

Add this comment and it will be ok

Published 281 original articles · 50 praises · 450,000 views +

Guess you like

Origin blog.csdn.net/lzh657083979/article/details/79417467