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