title: Parse JSON file with Gson
body: <p>I have a method that gets the strongest Wifi acces points signal, which avialabe is and  returns SSID string, all these SSID strings are stored in the raw folder in JSON file: How can I access the file in the raw folder and parse it with Gson to get for example  the route_number 6 if the SSID "FR WLAN" is?</p>
  
  <p>ssid_number JSON file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js 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>
  </div>
  </div>
  </p>
  
  <p>WifiJSON class:</p>
  
  <pre><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>parse_SSID in the MainActivity:</p>
  
  <pre><code>             //parse the storeed json file"ssid_number" and get the route_number back.
          private int parse_SSID(String route_string) {
              // TODO Auto-generated method stub
              InputStream is = getResources().openRawResource(R.raw.ssid_number);
              Gson gson = new Gson();
              WifiJSON obj = gson.fromJson(route_string, WifiJSON.class);
  
  
              return 0;
          }
      }
  </code></pre>
  
  <p>WiFiJSONList class:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js 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>
  </div>
  </div>
  </p>