@Override
  public Distance read(JsonReader reader) throws IOException {
    if (reader.peek() == JsonToken.NULL) {
      reader.nextNull();
      return null;
    }

    Distance distance = new Distance();

    reader.beginObject();
    while (reader.hasNext()) {
      String name = reader.nextName();
      if (name.equals("text")) {
        distance.humanReadable = reader.nextString();
      } else if (name.equals("value")) {
        distance.inMeters = reader.nextLong();
      }
    }
    reader.endObject();

    return distance;
  }
Read a distance object from a Directions API result and convert it to a {@link Distance}.

<p>We are expecting to receive something akin to the following:

<pre>
{
  "value": 207, "text": "0.1 mi"
}
</pre>
src/main/java/com/google/maps/internal/DistanceAdapter.java