-1

I have a json string like so:

{
"user-TESTING": [{
    "name": "SERVICE",
    "label": "another test",
    "tags": [],
    "credentials": {
        "PASSWORD": "TestMe",
        "NAME": "http://www.blahblah",
        "USER": "TEST"
    },
    "syslog_url": ""
}]

}

How would I format my class so I can use gson.fromJson(<jsonString>, <class>) ?

Vladimir Vagaytsev
  • 2,871
  • 9
  • 33
  • 36
Doc Holiday
  • 9,928
  • 32
  • 98
  • 151

1 Answers1

1
class Something
{
    @SerializedName("user-TESTING")
    User[] user;

    static class User
    {
        String name;
        String label
        String[] tags;
        Credentials credentials;
        String syslog_url;
    }

    static class Credentials
    {
        String PASSWORD;
        String NAME;
        String USER;
    }
}

I don't know the content of tags, so I guessed String.