private static JSONObject packageResult(List<? extends ReplicaId> replicaIds) throws JSONException {
    JSONObject result = new JSONObject();
    if (replicaIds != null) {
      for (ReplicaId replicaId : replicaIds) {
        result.append(REPLICAS_KEY, replicaId.toString());
      }
    }
    return result;
  }
Packages the list of replicas into a {@link JSONObject}.
@param replicaIds the list of {@link ReplicaId}s that need to packaged into a {@link JSONObject}.
@return A {@link JSONObject} that wraps the replica list.
@throws JSONException if there was an error building the {@link JSONObject}.
ambry-frontend/src/main/java/com/github/ambry/frontend/GetReplicasHandler.java