繁体   English   中英

无法通过方法调用转换将JSONObject转换为String

[英]JSONObject cannot be converted to String by method invocation conversion

(新警报)

我正在使用Java-WebSocketjson-simple

解决与问题后put婷到JSONObject这个问题使用旧代码不使用泛型时,如何避免Eclipse的警告? ,我现在正在尝试发送sendToAll obj但正在

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

如何sendToAll obj

obj是一个JSONObject ,该方法需要一个String 我确定有某种方法可以将您的obj转换为可识别它的String ,但是我不知道它是什么。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM