【发布时间】:2017-06-14 14:29:28
【问题描述】:
我在 JSONObject 中遇到编译错误:
The constructor JSONObject(HashMap<String,String>) is undefined
在这段代码中:
import java.util.HashMap;
import org.json.simple.JSONObject;
HashMap<String, String> resJson = new HashMap<String, String>();
resJson.put("author", author);
resJson.put("msg", msg);
return (new JSONObject(resJson)).toString();
那么,谁能帮我解决这个问题?
【问题讨论】:
-
JSONObject(Map)已添加到版本1.1.1中。您显然使用的是早期版本。 -
谢谢!有了这个版本,它真的很有效)