0

I have a json object being sent to a controller that maps to a class model. The json contains the property below

"Event.GradeBook.GradeEvent": {  }

How can I represent this in a class model where it will map correctly?

String Event_Gradebook_GradeEvent;
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341

1 Answers1

2

Assuming you are using Spring's default Jackson deserialization, all you need to do is annotate your field with @JsonProperty.

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

But you should really follow Java's naming conventions.

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
  • That worked, yes my property name isnt like that but I wanted to give a visual on what I thought might be the correct answer. – Mike Flynn Dec 18 '13 at 16:15
  • Do you know how to do this one http://stackoverflow.com/questions/20670456/map-post-parameter-to-model-in-spring-controller? – Mike Flynn Dec 19 '13 at 04:08