docs: public static JSONObject toJSONObject(String string) throws JSONException {
          String         name;
          JSONObject     jo = new JSONObject();
          Object         value;
          JSONTokener x = new JSONTokener(string);
          jo.put("name", x.nextTo('='));
          x.next('=');
          jo.put("value", x.nextTo(';'));
          x.next();
          while (x.more()) {
              name = unescape(x.nextTo("=;"));
              if (x.next() != '=') {
                  if (name.equals("secure")) {
                      value = Boolean.TRUE;
                  } else {
                      throw x.syntaxError("Missing '=' in cookie parameter.");
                  }
              } else {
                  value = unescape(x.nextTo(';'));
                  x.next();
              }
              jo.put(name, value);
          }
          return jo;
      }