code: public JSONObject switchToJSON(Switch s) {
          JSONObject o = new JSONObject();
          o.put("id", s.id());
          o.put(CAPACITY_LABEL, s.getCapacity());
          return o;
      }
docs: Convert a Switch to a JSON object.
  
  @param s the switch to convert
  @return  the JSON object