title: How to parse the Google Places API for City, State, Country code and Zip details?
body: <p>I'm parsing the google places api for specific format of address. But I'm getting null values after parsing. I want the address format be like: <code>Mumbai, Maharashtra, IN, 400047</code>. For that I'm saving the param <code>types</code> of <code>address_components</code> into ArrayList and then checking for specific string. But I'm getting null as values. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>JSONObject jsonObject = new JSONObject(stringBuilder.toString());
                      if (jsonObject.getString("status").equals("OK")) {
                          JSONArray array = jsonObject.getJSONArray("results");
                              for(int k=0;k&lt;array.length();k++){
                                  JSONObject jObj = array.getJSONObject(0);
                                  JSONArray jarr = jObj.getJSONArray("address_components");
                                  for(int i=0; i&lt;jarr.length();i++){
                                      JSONObject jobj = jarr.getJSONObject(i);
                                      String long_name = jobj.getString("long_name");
                                      String short_name = jobj.getString("short_name");
                                      JSONArray jarray = jobj.getJSONArray("types");
                                      for(int j=0; j&lt;jarray.length();j++){
                                          typo.add(jarray.getString(j));
                                          if(Arrays.asList(typo).contains("administrative_area_level_2")){
                                              cityStr = long_name;
                                          }else if(Arrays.asList(typo).contains("administrative_area_level_1")){
                                              stateStr = long_name;
                                          }else if(Arrays.asList(typo).contains("country")){
                                              countryStr = short_name;
                                          }else if(Arrays.asList(typo).contains("postal_code")){
                                              zipStr = long_name;
                                          }
  
                                      }
  
  
                                  }
                              }
  
                              result = cityStr + ", " + stateStr + ", " + zipStr + ", " + countryStr;
                            
  
  
                      }</code></pre>
  </div>
  </div>
  </p>