title: Android: parse the JSON file in the raw folder with gson?
body: <p>I am trying to parse JSON file"ssid-number" in the raw folder with GSON. The parse_SSID method parses the JSON file and finds the mapping for the passed SSID  string. I am getting at the momenat this error:<code>The method getWifiList() is undefined for the type WifiJSON</code> at this line <code>List&lt;WifiJSON&gt; wifijson = obj.getWifiList();</code>. Is my approach correct?</p>
  
  <p>JSON file:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
      "data": [
          {
              "ssid": "KD Privat",
              "route_number": 1
          },
          {
              "ssid": "KD WLAN Hotspot",
              "route_number": 4
          },
          {
              "ssid": "FR WLAN",
              "route_number": 6
          }
      ]
  }
  </code></pre>
  
  <p>parse_SSID method in the MainActivity:</p>
  
  <pre class="lang-js prettyprint-override"><code>        private int parse_SSID(String ssid) {
  
               InputStream raw =  getResources().openRawResource(R.raw.ssid_number);
               Reader rd = new BufferedReader(new InputStreamReader(raw));
               Gson gson = new Gson();            
              WifiJSON obj = gson.fromJson(rd, WifiJSON.class);
              // Now iterate through the list
              List&lt;WifiJSON&gt; wifijson = obj.getWifiList(); //here is my error.
              Iterator iterator = wifijson.iterator();
              while (iterator.hasNext()) {
                  WifiJSON wifielement = (WifiJSON) iterator.next();
                  System.out.println(wifielement.getSsid() + "----"
                          + wifielement.getRoute_number());
              }
  
          }
  </code></pre>
  
  <p>WifiJSON class:</p>
  
  <pre class="lang-js prettyprint-override"><code>public class WifiJSON {
      private String ssid;
      private int route_number;
  
      public WifiJSON(String ssid, int route_number) {
          this.ssid = ssid;
          this.route_number = route_number;
  
      }
  
      private String getSsid() {
          return ssid;
      }
  
      private void setSsid(String ssid) {
          this.ssid = ssid;
      }
  
      private int getRoute_number() {
          return route_number;
      }
  
      private void setRoute_number(int route_number) {
          this.route_number = route_number;
      }
  
      @Override
      public String toString() {
          return "WifiJSON [ssid=" + ssid + ", route_number=" + route_number
                  + "]";
      }
  
  
  
  }
  </code></pre>
  
  <p>WiFiJSONList class:</p>
  
  <pre class="lang-js prettyprint-override"><code>import java.util.ArrayList;
  
  public class WiFiJSONList {
      private ArrayList&lt;WifiJSON&gt; data;
  
      public ArrayList&lt;WifiJSON&gt; getWifiList() {
          return data;
      }
      public void setWifiList(ArrayList&lt;WifiJSON&gt; wifiList) {
          this.data = wifiList;
      }
  }
  </code></pre>