title: How can I get Latitude and Longitude From JSON web Service?
body: <p>I am Converting <strong>Country Name</strong> Which is in <strong>String format</strong> to <strong>Longitude and Latitude</strong>.</p>
  
  <p>For that I am using following <strong>JSON web service</strong>.</p>
  
  <p><strong><a href="https://maps.googleapis.com/maps/api/geocode/json?address=India&amp;sensor=true" rel="nofollow">https://maps.googleapis.com/maps/api/geocode/json?address=India&amp;sensor=true</a></strong></p>
  
  <p>I dont know how to get <strong>Longitude and Latitude</strong> from that JSON.</p>
  
  <p>Please <strong>help me to get Longitude and Latitude from the above web service.</strong></p>
  
  <p>I had tried code below but I am not sure it is correct or not:</p>
  
  <pre><code>try 
  {
                      Log.v("MAPS","Lang-Lat::1");
                      String myjsonstring = stringBuffer.toString();
                      Log.v("My JSON STRING",""+myjsonstring);
                      Log.v("MAPS","Lang-Lat::2");    
                      JSONArray jsonArray = new JSONArray(myjsonstring);
  
                      Log.v("MAPS","Lang-Lat::3");
                      JSONObject jsonObj = null;
  
                      String status = jsonObj.getString("status");
                      Log.v("MAPS","Lang-Lat::4");
                      if (status.equals("OK")) 
                      {
                          Log.v("Log Receive","Json String:::"+myjsonstring);                 
  
                          jsonObj = jsonArray.getJSONObject(0);
  
                          JSONObject JSONObject2=jsonObj.getJSONObject("geometry");
  
                          JSONObject JSONObject3=JSONObject2.getJSONObject("bounds");
  
                          JSONObject JSONObject4=JSONObject3.getJSONObject("northeast");
  
                          for(int i=0; i&lt;JSONObject4.length();i++)
                          {
                              lang = JSONObject4.getDouble("lng");
                              lat=JSONObject4.getDouble("lat");
  
                              Log.v("Lang:",""+lang);
                              Log.v("Lat",""+lat);
  
                          }
                      }
                  } 
                  catch (Exception e) 
                  {
                      Log.v("Map_View::","Call JSON Exception in Getting Map---&gt;"+e.toString());
                      e.printStackTrace();
                  }
  </code></pre>
  
  <p>Any Help will be Appreciated.</p>
  
  <p>Thank You in Advance.</p>