unmarshalling nested json without knowing keys jaxb java

时间:2015-10-30 22:59:41

标签: java jaxb unmarshalling

I am fairley new to java and Jaxb and am stuck on unmarshaling an json structor like this, I cant find a way to create the RANDOMEACCOUNT and RANDOMSUBACC objects so the values nested in them can be unmarshalled.

{
  "visit_id": "56602e810ef9d7487eef9f282e9e2f53",
  "skills": {
    "accounts": {
      "RANDOMACCOUNT": {
        "RANDOMSUBACC": {
          "default": true,
          "enabled": false
        }
      }
    }
  }
  }

Here's what I have so far for the Skills class (It is not the XmlRootElement) and do not know how to define

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="skills")
public class Skills {
    private Accounts accounts;

    public Accounts getAccounts() {
        return accounts;
    }

    public void setAccounts(Accounts accounts) {
        this.accounts = accounts;
    }

    @Override
    public String toString() {
        return "Skills: accounts=" + accounts;
    }
}

0 个答案:

没有答案