code: public static StartupSettings fromJSONFile(File jsonFile) throws JSONException,
            FileNotFoundException, IOException {
      // Read the file to a String.
      StringBuffer buffer = new StringBuffer();
      try (BufferedReader br = new BufferedReader(new FileReader(jsonFile)) ){
        String line;
        while ((line = br.readLine()) != null) {
          buffer.append(line.trim());
        }
      }
      
      JSONObject jsonObject = new JSONArray(buffer.toString()).getJSONObject(0);
      int port = jsonObject.getInt("port");
      String id = jsonObject.getString("id");
      int gossipInterval = jsonObject.getInt("gossip_interval");
      int cleanupInterval = jsonObject.getInt("cleanup_interval");
      String cluster = jsonObject.getString("cluster");
      if (cluster == null){
        throw new IllegalArgumentException("cluster was null. It is required");
      }
      StartupSettings settings = new StartupSettings(id, port, new GossipSettings(gossipInterval,
              cleanupInterval), cluster);
  
      // Now iterate over the members from the config file and add them to the settings.
      String configMembersDetails = "Config-members [";
      JSONArray membersJSON = jsonObject.getJSONArray("members");
      for (int i = 0; i < membersJSON.length(); i++) {
        JSONObject memberJSON = membersJSON.getJSONObject(i);
        RemoteGossipMember member = new RemoteGossipMember(memberJSON.getString("cluster"),
                memberJSON.getString("host"), memberJSON.getInt("port"), "");
        settings.addGossipMember(member);
        configMembersDetails += member.getAddress();
        if (i < (membersJSON.length() - 1))
          configMembersDetails += ", ";
      }
      log.info(configMembersDetails + "]");
  
      // Return the created settings object.
      return settings;
    }
docs: Parse the settings for the gossip service from a JSON file.
  
  @param jsonFile
  The file object which refers to the JSON config file.
  @return The StartupSettings object with the settings from the config file.
  @throws JSONException
  Thrown when the file is not well-formed JSON.
  @throws FileNotFoundException
  Thrown when the file cannot be found.
  @throws IOException
  Thrown when reading the file gives problems.