public static Map<String, List<DbEndpoint>> getDbEndpointsPerDC(String dbInfoJsonString) throws JSONException {
    Map<String, List<DbEndpoint>> dcToDbEndpoints = new HashMap<>();

    JSONArray dbInfo = new JSONArray(dbInfoJsonString);
    for (int i = 0; i < dbInfo.length(); i++) {
      JSONObject entry = dbInfo.getJSONObject(i);
      DbEndpoint dbEndpoint = DbEndpoint.fromJson(entry);
      dcToDbEndpoints.computeIfAbsent(dbEndpoint.datacenter, key -> new ArrayList<>()).add(dbEndpoint);
    }
    return dcToDbEndpoints;
  }
Parses DB information JSON string and returns a map of datacenter name to list of {@link DbEndpoint}s.
@param dbInfoJsonString the string containing the MySql DB info.
@return a map of dcName -> list of {@link DbEndpoint}s.
@throws JSONException if there is an error parsing the JSON.
ambry-mysql/src/main/java/com/github/ambry/mysql/MySqlUtils.java