obj
is a JSONObject
, and the method requires a String
. I'm sure there is some way to convert your obj
into a String
identifying it, but I don't know what it is.
JSONObject cannot be converted to String by method invocation conversion
-
03-06-2022 - |
سؤال
(newb alert)
I'm using Java-WebSocket and json-simple.
After resolving problems with put
ting to a JSONObject
with this question How to avoid Eclipse warnings when using legacy code without generics?, I'm now trying to sendToAll
obj
but am getting
error: method sendToAll in class WebSocketServerBase cannot be applied
to given types;
ws.sendToAll(obj);
^
required: String
found: JSONObject
reason: actual argument JSONObject cannot be converted to String by method
invocation conversion
1 error
How can I sendToAll
obj
?
المحلول
لا تنتمي إلى StackOverflow