-1

This is the json String:

{
  new : "",
  xx : "yy",
  ......
}

java, for the key new,

private String new;

is illegal.

How to write my domain Class?

Braj
  • 46,415
  • 5
  • 60
  • 76
steven.tong
  • 345
  • 3
  • 16

1 Answers1

2

How to write my domain Class?

Since new is a keyword in java hence you can't use it as variable name. You can use annotation SerializedName that that indicates this member should be serialized to JSON with the provided name value as its field name.

Sample Domain class:

class NewDetail{
    @SerializedName(value="new")
    private String newValue;
    private String xx;
    // getter & setter
}
Braj
  • 46,415
  • 5
  • 60
  • 76