public static RoomLocationReturn fromServerJson(JsonParser p)
      throws JsonParseException, IOException {

    RoomLocationReturn ret = new RoomLocationReturn();

    RoomLocationEntry entry = new RoomLocationEntry();

    while (p.nextToken() != JsonToken.END_OBJECT) {

      String fieldName = p.getCurrentName();
      if (KEY_BUILDING.equals(fieldName)) {
        p.nextToken();
        entry.setBuildingName(p.getText());
      } else if (KEY_ROOM.equals(fieldName)) {
        p.nextToken();
        entry.setRoomName(p.getText());
      } else if (KEY_LATITUDE.equals(fieldName)) {
        p.nextToken();
        entry.setLatitude(p.getDoubleValue());
      } else if (KEY_LONGITUDE.equals(fieldName)) {
        p.nextToken();
        entry.setLongitude(p.getDoubleValue());
      } else if (KEY_RATING.equals(fieldName)) {
        p.nextToken();
        // We assume that rating <--> productivity (they are interchangeable)
        entry.setProductivity(p.getDoubleValue());
      } else if (KEY_CAPACITY.equals(fieldName)) {
        p.nextToken();
        entry.setCapacity(p.getDoubleValue());
      } else if (KEY_CROWD.equals(fieldName)) {
        p.nextToken();
        entry.setAglCrowd(p.getDoubleValue());
      } else if (KEY_NUM_SURVEYS.equals(fieldName)) {
        p.nextToken();
        entry.setAglSurveys(p.getIntValue());

      } else if (KEY_INTERPOLATED.equals(fieldName)) {
        p.nextToken(); // take the "[" token
        List<NoiseEntry> noises = new ArrayList<NoiseEntry>();
        while (p.nextToken() != JsonToken.END_ARRAY) {
          noises.add(NoiseEntry.fromServerJson(p, entry));
        }
        ret.noises = noises;
      } else if (KEY_COMMENTS.equals(fieldName)) {
        p.nextToken(); // take the "[" token
        List<CommentEntry> comments = new ArrayList<CommentEntry>();
        while (p.nextToken() != JsonToken.END_ARRAY) {
          comments.add(CommentEntry.fromServerJson(p, entry));
        }
        ret.comments = comments;
      }
    }
    entry.setLocal(false);

    ret.entry = entry;

    return ret;
  }
 @Override
 public RoomLocationEntry createFromParcel(Parcel source) {
   RoomLocationEntry mEntry = new RoomLocationEntry();
   mEntry.setLatitude(source.readDouble());
   mEntry.setLongitude(source.readDouble());
   mEntry.setBuildingName(source.readString());
   mEntry.setRoomName(source.readString());
   mEntry.setProductivity(source.readInt());
   mEntry.setCapacity(source.readInt());
   mEntry.setAglCrowd(source.readInt());
   mEntry.setLocal(source.readByte() == (byte) 1);
   return mEntry;
 }