json and wrapper for gson
<p>I am trying to get some the array of actors from Jira.  The code for the wrapper is used in a Gson.fromJson call.  I had used something similar with a json string that did not have an array in it that had the information I needed and it worked fine, so the issue seems to do with the array, but I am not 100% sure:</p>

<pre class="lang-java prettyprint-override"><code>import com.google.gson.annotations.SerializedName;

public class JiraRoleJsonWrapper {
    @SerializedName("self")
    private String self;
    @SerializedName("name")
    private String name;
    @SerializedName("id")
    private int id;
    @SerializedName("description")
    private String description;
    @SerializedName("actors")
    private JiraActors[] actors;

    public JiraActors[] getActors() {
        return actors;
    }
    public void setActors(JiraActors[] actors) {
        this.actors = actors;
    }

    public String getSelf() {
        return self;
    }

    public void setSelf(String self) {
        this.self = self;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String key) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /*
    public String[] getAvatarUrls() {
        return avatarUrls;
    }

    public void setAvatarUrls(String[] avatarUrls) {
        this.avatarUrls = avatarUrls;
    }
    */
}

class JiraActors {
    @SerializedName("id")
    private int id;
    @SerializedName("displayNme")
    private String displayName;
    @SerializedName("type")
    private String type;
    @SerializedName("name")
    private String name;
    //@SerializedName("avatarUrl")
    //private String avatarUrl;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

} 
</code></pre>

<p>The json it would receive:</p>

<pre class="lang-json prettyprint-override"><code>{
    "self":"http://someserver.com:8080/apps/jira/rest/api/2/project/10741/role/10002",
"name":"Administrators",
"id":10002,
"description":"A project role",
"actors":[
    {
        "id":12432,
        "displayName":"Joe Smith",
        "type":"atlassian-user-role-actor",
        "name":"joesmi",
        "avatarUrl":"/apps/jira/secure/useravatar?size=xsmall&amp;ownerId=dawsmi&amp;avatarId=12245"
    },
    {
        "id":12612,
        "displayName":"Smurfette Desdemona",
        "type":"atlassian-user-role-actor",
        "name":"smudes",
        "avatarUrl":"/apps/jira/secure/useravatar?size=xsmall&amp;ownerId=lamade&amp;avatarId=10100"
    },
</code></pre>

<p>This shows two actors and the format of the json.  Please note I did not put a complete json response. It just shows two actors.</p>

<p>In my code, I tried the following to retrieve the actors:</p>

<pre class="lang-java prettyprint-override"><code>InputStream is = response.getEntityInputStream();
                Reader reader = new InputStreamReader(is);
                Gson gson = new Gson();

                JiraRoleJsonWrapper[] jiraRoleJsonWrapper = gson.fromJson(reader, JiraRoleJsonWrapper[].class);
                for (JiraRoleJsonWrapper w : jiraRoleJsonWrapper) {
                    JiraActors[] a = w.getActors();
                    String name = a.getName();
</code></pre>

<p>It does not find getName for some reason.  I am not sure why.</p>