title: gson.fromJson Expected BEGIN_OBJECT but was BEGIN_ARRAY
body: <p>json class:</p>
  
  <pre><code>package json;
  
  public class RankAPI {
      private String hotStreak;
      private String leagueName;
      private String tier;
      private String freshBlood;
      private String playerOrTeamId;
      private String leaguePoints;
      private String inactive;
      private String rank;
      private String veteran;
      private String queueType;
      private String losses;
      private String playerOrTeamName;
      private String wins;
  
  public String getHotStreak ()
  {
      return hotStreak;
  }
  
  public void setHotStreak (String hotStreak)
  {
      this.hotStreak = hotStreak;
  }
  
  public String getLeagueName ()
  {
      return leagueName;
  }
  
  public void setLeagueName (String leagueName)
  {
      this.leagueName = leagueName;
  }
  
  public String getTier ()
  {
      return tier;
  }
  
  public void setTier (String tier)
  {
      this.tier = tier;
  }
  
  public String getFreshBlood ()
  {
      return freshBlood;
  }
  
  public void setFreshBlood (String freshBlood)
  {
      this.freshBlood = freshBlood;
  }
  
  public String getPlayerOrTeamId ()
  {
      return playerOrTeamId;
  }
  
  public void setPlayerOrTeamId (String playerOrTeamId)
  {
      this.playerOrTeamId = playerOrTeamId;
  }
  
  public String getLeaguePoints ()
  {
      return leaguePoints;
  }
  
  public void setLeaguePoints (String leaguePoints)
  {
      this.leaguePoints = leaguePoints;
  }
  
  public String getInactive ()
  {
      return inactive;
  }
  
  public void setInactive (String inactive)
  {
      this.inactive = inactive;
  }
  
  public String getRank ()
  {
      return rank;
  }
  
  public void setRank (String rank)
  {
      this.rank = rank;
  }
  
  public String getVeteran ()
  {
      return veteran;
  }
  
  public void setVeteran (String veteran)
  {
      this.veteran = veteran;
  }
  
  public String getQueueType ()
  {
      return queueType;
  }
  
  public void setQueueType (String queueType)
  {
      this.queueType = queueType;
  }
  
  public String getLosses ()
  {
      return losses;
  }
  
  public void setLosses (String losses)
  {
      this.losses = losses;
  }
  
  public String getPlayerOrTeamName ()
  {
      return playerOrTeamName;
  }
  
  public void setPlayerOrTeamName (String playerOrTeamName)
  {
      this.playerOrTeamName = playerOrTeamName;
  }
  
  public String getWins ()
  {
      return wins;
  }
  
  public void setWins (String wins)
  {
      this.wins = wins;
  }
  
  @Override
  public String toString()
  {
      return "ClassPojo [hotStreak = "+hotStreak+", leagueName = "+leagueName+", tier = "+tier+", freshBlood = "+freshBlood+", playerOrTeamId = "+playerOrTeamId+", leaguePoints = "+leaguePoints+", inactive = "+inactive+", rank = "+rank+", veteran = "+veteran+", queueType = "+queueType+", losses = "+losses+", playerOrTeamName = "+playerOrTeamName+", wins = "+wins+"]";
  }
  }
  </code></pre>
  
  <p>other code:</p>
  
  <pre><code>package com.rhidlor.leaguetool;
  
  import json.SummonerAPI;
  import json.RankAPI;
  import com.google.gson.Gson;
  import com.google.gson.annotations.SerializedName;
  import java.io.IOException;
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Label;
  import javafx.scene.control.TextField;
  import okhttp3.OkHttpClient;
  import okhttp3.Request;
  import okhttp3.Response;
  
  public class FXMLController implements Initializable {
      public static OkHttpClient client = new OkHttpClient();
      public static Gson gson = new Gson();
      public static SummonerAPI summonerAPI;
      public static RankAPI rankAPI;
      public static String summonerJSON = null;
      public static String rankJSON = null;
      public static String username;
      public static String id;
      public String key = "RGAPI-dd11b8d0-3178-4eb1-8dfa-0d5bf6fb1b24";
      //https://na1.api.riotgames.com
  
  @FXML private Label summonerLabel;
  @FXML private Label rankLabel;
  @FXML private Label winrateLabel;
  @FXML private TextField usernameTextField;
  
  @FXML
  private void handleButtonAction(ActionEvent event) {
      username = usernameTextField.getText();
      try{
          summonerJSON  = getJSON("https://na1.api.riotgames.com/lol/summoner/v3/summoners/by-name/" + username + "?api_key=" + key);  
      }catch(Exception e) {
              e.printStackTrace();
      }
      summonerAPI = gson.fromJson(summonerJSON, SummonerAPI.class);
      id = summonerAPI.getId();
      System.out.println("ID: " + id);
  
      try{
          rankJSON = getJSON("https://na1.api.riotgames.com/lol/league/v3/positions/by-summoner/" + id + "?api_key=" + key);
          System.out.println("This worked");
      }catch(Exception e) {
          System.out.println("This failed");
          e.getCause().printStackTrace();
      }
      rankAPI = gson.fromJson(rankJSON, RankAPI.class);
  
      setValues(username);
  }
  
  public static String getJSON(String url) throws IOException {
      Request request = new Request.Builder()
      .url(url)
      .build();
  
      Response response = client.newCall(request).execute();
      return response.body().string();
  }
  
  public void setValues(String username){
      summonerLabel.setText(username + " Level: " + summonerAPI.getSummonerLevel());
      //System.out.println(rankAPI.getWins());
      //rankLabel.setText("Rank: " + rankAPI.getTier() + " " + rankAPI.getRank() + " LP: " + rankAPI.getLeaguePoints());
      //int winrate = (parseInt(rankAPI.getWins()) / (parseInt(rankAPI.getWins()) + parseInt(rankAPI.getLosses()))) * 100;
      //winrateLabel.setText("Winrate: " + winrate + "%");
  }
  
  @Override
  public void initialize(URL url, ResourceBundle rb) {
      // TODO
  }    
  </code></pre>
  
  <p>}</p>
  
  <p>This line causes the error:</p>
  
  <pre><code>rankAPI = gson.fromJson(rankJSON, RankAPI.class);
  </code></pre>
  
  <p>Error: Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ </p>
  
  <p>If anyone could help me with this it would be greatly appreciated. The SummonerAPI portion of this code works perfectly and it's json class is nearly identical to the RankAPI json class.</p>
  
  <p>I understand some off the code may not make sense or seem out of place, thats because I was trying to troubleshoot the code but clearly failed.</p>