is there a way to bind a form with underscore field?

20 views
Skip to first unread message

Boram Han

unread,
Sep 21, 2016, 2:46:23 AM9/21/16
to Play Framework

I want to post data with json format with underscore field. But play does not accept it. 

Here is my form class.
public class RegisterDeviceTokenRequest {
   
private String token;
   
private String build;
   
private String deviceUuid;
   
private String deviceType;
}


To bind a form I should use this format. 
{
 
"token" : "11",
 
"build" : "relase"
 
"deviceUuid" : "1010",
 
"deviceType" : "ios"
}


But I want this. 
{
 
"token" : "11",
 
"build" : "relase"
 
"device_uuid" : "1010",
 
"device_type" : "ios"
}


How can I use underscore filed in json format for binding form?
I searched whole month but I couldn't find a solution. :(


Sivakumar Raja

unread,
Sep 21, 2016, 4:24:00 AM9/21/16
to play-fr...@googlegroups.com
Using com.fasterxml.jackson.annotation.JsonProperty annotation, you can achieve it. Have a look at this link.


--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d023b0d4-f872-411d-be0f-e398b8cbbf1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages