Map Json Property with Time-to-Class Function in Spring Controller

I have a json object that is dispatched to a controller that maps to a class model. Json contains the property below

"Event.GradeBook.GradeEvent": {  }

How can I imagine this in a class model where it will display correctly?

String Event_Gradebook_GradeEvent;
0
source share
1 answer

Assuming you are using the default Spring deserialization by default, all you have to do is annotate your field with @JsonProperty.

@JsonProperty(value = "Event.GradeBook.GradeEvent")
private String Event_Gradebook_GradeEvent;

But you must follow the Java naming conventions.

+2
source

Source: https://habr.com/ru/post/1726308/


All Articles