title: Retrofit GSON Returning null
body: <p>I am trying to make a simple app using the Retrofit that will parse the JSON Array and will fetch some data such as latitude and longitude but the problem is that is is returning null. I am new to Retrofit. Please explain whatever you post the solution</p>
  
  <p>Here is my code</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.akshay.retrofitgsonjsonarray;
  
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.widget.Toast;
  
  import retrofit.Callback;
  import retrofit.RestAdapter;
  import retrofit.RetrofitError;
  import retrofit.client.Response;
  
  public class MainActivity extends AppCompatActivity {
      public final String URL = "https://roads.googleapis.com/v1";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(URL).setLogLevel(RestAdapter.LogLevel.FULL).build();
          api api = restAdapter.create(api.class);
          api.getData(new Callback&lt;SnappedPoints&gt;() {
              @Override
              public void success(SnappedPoints snappedPoints, Response response) {
                  Toast.makeText(MainActivity.this ,String.valueOf(snappedPoints.location.getLatitude()) , Toast.LENGTH_LONG ).show();
              }
  
              @Override
              public void failure(RetrofitError error) {
                  Toast.makeText(MainActivity.this, "Something went wrong", Toast.LENGTH_LONG).show();
              }
          });
      }
  
  
  }
  </code></pre>
  
  <p>Snappedpoints.java</p>
  
  <pre><code>package com.example.akshay.retrofitgsonjsonarray;
  
  import com.google.gson.annotations.Expose;
  import com.google.gson.annotations.SerializedName;
  
  /**
   * Created by Akshay on 9/14/2015.
   */
  public class SnappedPoints {
  
      @SerializedName("location")
              @Expose
      Location location;
  
  
      public void setLocation(Location location)
      {
          this.location = location;
  
      }
      public Location getLocation()
      {
          return location;
      }
  }
  </code></pre>
  
  <p>Location.java</p>
  
  <pre><code>package com.example.akshay.retrofitgsonjsonarray;
  
  import com.google.gson.annotations.Expose;
  import com.google.gson.annotations.SerializedName;
  
  /**
   * Created by Akshay on 9/14/2015.
   */
  public class Location {
  
  
      @SerializedName("latitude")
      @Expose
      Double latitude;
      @SerializedName("longitude")
      @Expose
      Double longitude;
  
      public void setLatitude(Double latitude) {
          this.latitude = latitude;
      }
  
      public Double getLatitude() {
          return latitude;
      }
  
      public void setLongitude(Double longitude) {
          this.longitude = longitude;
      }
  
      public Double getLongitude() {
          return longitude;
      }
  }
  </code></pre>
  
  <p>api.java</p>
  
  <pre><code>package com.example.akshay.retrofitgsonjsonarray;
  import retrofit.Callback;
  import retrofit.http.GET;
  
  /**
   * Created by Akshay on 9/8/2015.
   */
  public interface api {
      @GET("/snapToRoads?path=-35.27801,149.12958&amp;interpolate=true&amp;key=KEY")
      public void getData( Callback&lt;SnappedPoints&gt; response);
  }
  </code></pre>
  
  <p>I am Trying to get latitude and longitude out of it but I am not getting any result</p>
  
  <p>Here is my Logcat:</p>
  
  <pre><code>09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ &lt;--- HTTP 200 https://roads.googleapis.com/v1/snapToRoads?path=-35.27801,149.12958&amp;interpolate=true&amp;key=KEYHERE_Ihavechangedthis (1901ms)
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ : HTTP/1.1 200 OK
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Alt-Svc: quic=":443"; p="1"; ma=604800
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Alternate-Protocol: 443:quic,p=1
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Cache-Control: private
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Content-Type: application/json; charset=UTF-8
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Date: Mon, 14 Sep 2015 09:23:17 GMT
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Server: ESF
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Transfer-Encoding: chunked
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Vary: Origin
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Vary: X-Origin
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ Vary: Referer
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-Android-Received-Millis: 1442222595815
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-Android-Response-Source: NETWORK 200
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-Android-Sent-Millis: 1442222595304
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-Content-Type-Options: nosniff
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-Frame-Options: SAMEORIGIN
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ X-XSS-Protection: 1; mode=block
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ {
      "snappedPoints": [
      {
      "location": {
      "latitude": -35.278005228392438,
      "longitude": 149.12953569405369
      },
      "originalIndex": 0,
      "placeId": "ChIJp47M1mdNFmsRcF5UbW7qABM"
      }
      ]
      }
  09-14 14:53:15.820  19592-19636/com.example.akshay.retrofitgsonjsonarray D/Retrofit﹕ &lt;--- END HTTP (224-byte
  </code></pre>
  
  <p>body)</p>