-1

I have got really weird Json object from a third party service provider and I have issue implementing the same. Below is the json object.

{
  "signers": [
    "xyz@abc.com"
  ],
  "will_self_sign": true,
  "signatory": "nbc@hgj.com",
  "callback": "79474939202836",
  "comment": "Please sign the document",
  "expire_in_days": 10,
  "display_on_page": "all",
  "sign_coordinates": {
    "xyz@abc.com": {
      "1": [
        {
          "llx": 315,
          "lly": 20,
          "urx": 455,
          "ury": 60
        }
      ]
    },
    "xyz1@abc.com": {
      "1": [
        {
          "llx": 315,
          "lly": 20,
          "urx": 455,
          "ury": 60
        }
      ],
      "2": [
        {
          "llx": 315,
          "lly": 20,
          "urx": 455,
          "ury": 60
        }
      ],

    }
  }
}

My Java objects look like below

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DigioUpload {

    @JsonProperty(value = "signers", required = true)
    public List<String> signers;

    @JsonProperty(value = "will_self_sign")
    public Boolean willSelfSign;

    @JsonProperty("signatory")
    public String signatory;

    @JsonProperty("callback")
    public String callback;

    @JsonProperty("comment")
    public String comment;

    @JsonProperty(value = "expire_in_days")
    public Integer expireInDays;

    @JsonProperty("display_on_page")
    public String displayOnPage;

    @JsonProperty("sign_coordinates")

    public Map<String, SignDetails> signCoordinates;

}


public class SignDetails {

    public HashMap<String, SignCoordinates> details;

}

public class SignCoordinates {


    public Map<String, List<Coordinates>> coordinates;


}

class Coordinates {

    public Integer llx;
    public Integer lly;
    public Integer urx;
    public Integer ury;
}

Unable to map the objects inside dynamic keys like "xyz@abc.com" Any help is appreciated.

Result is as below:

{"signers":["xyz@abc.com"],"will_self_sign":true,"signatory":"nbc@hgj.com","callback":"79474939202836","comment":"Please sign the document","expire_in_days":10,"display_on_page":"all","sign_coordinates":{"xyz@abc.com":{},"xyz1@abc.com":{}}}
rohitanand
  • 710
  • 1
  • 4
  • 26

1 Answers1

0

Nevermind, I got it working by converting this public Map<String, SignDetails> signCoordinates; to public Map<String, Object> signCoordinates;

rohitanand
  • 710
  • 1
  • 4
  • 26